Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:06:10+00:00 2026-06-17T22:06:10+00:00

I have set my server s timezone to be UTC. My users can select

  • 0

I have set my server s timezone to be UTC. My users can select their own timezones like UTC+2 etc. I have created a query to indicate when a shift is open or closed:

SELECT DAYNAME(NOW()), start_day
FROM Shifts
WHERE (start_day = LOWER(DAYNAME(NOW()))
       AND start_time < CURTIME()
       AND end_time > CURTIME())
   OR (start_day = LOWER(DAYNAME(DATE_SUB(NOW(), INTERVAL 1 DAY)))
       AND start_time < ADDTIME('24:00:00', CURTIME())
       AND end_time > ADDTIME('24:00:00', CURTIME()))

I want to alter this query, NOW() and CURTIME() to match the settings of each user. How should I alter my query, to inject custom UTC in it? Is there another way to accomplish what I need ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:06:11+00:00Added an answer on June 17, 2026 at 10:06 pm

    CONVERT_TZ function will solve your problem.

    • Syntax

      CONVERT_TZ(dt, from_tz, to_tz).

      “from_tz” is your server timezone (in your case , UTC).

      “to_tz” value can be given as a string indicating an offset from “from_tz”, such as ‘+10:00’ or ‘-6:00’.

    • Examples:

       SELECT CONVERT_TZ('2004-01-01 12:00:00','UTC','+2:00');
       SELECT CONVERT_TZ(NOW(), 'UTC', '-5:30');
       SELECT CONVERT_TZ(NOW(), '-2:00', '+5:00')
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up Team Foundation Server - Team Web Access SP1. I can
I have a spring/jdbc/oracle 10g application. The Oracle server database timezone is set to
I have the timezone set on the server to BST (British Daylight Savings Time),
I have a MySQL Server set to UTC (@@global.time_zone = '+00:00') and a table
I have config.time_zone in environment.rb set to UTC, and my mySQL server returns the
I have set up a private mediawiki server for the purpose of documentation of
I have set up a XAMPP installation on a windows server 2008 R2 that
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I have set up a Redmine installation on a Windows server using the BitNami
I have set up 2 servers which are linked. From my LOCAL SERVER, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.