erikTsomik
asked on
sql current date based of on the time zone
I have the query that looking into a date. the sql looks at the condition where date <= 'date from the database'. I have 1 client that located in California (PST) and when he look at the recordset is nbot working for him. How would I say in sql to look at the localTime.
FOr example, the database is set to hjave startDate <= '7/1/2015' if I am in the east cost 12:00AM it is 7/2/12015 but in the west cost it is 9:00PM
FOr example, the database is set to hjave startDate <= '7/1/2015' if I am in the east cost 12:00AM it is 7/2/12015 but in the west cost it is 9:00PM
You might need to change the data type to datetimeoffset to store the time zone.
ASKER
Thank you Victor. But I not sure. For example the data get stored in Eastern Standard time, and applied in Pacific Time
Datetimeoffset allows you to save a data with his time zone.
You can confirm data by running the following query (check the last 6 characters from the 2nd column):
You can confirm data by running the following query (check the last 6 characters from the 2nd column):
select SYSDATETIME(), SYSDATETIMEOFFSET()
ASKER
How Would I interpret that on the other side, So if the time is EST and the client want to apply and check the date on PST zone how would the query looks like
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
You may want to read this:
https://msdn.microsoft.com/en-us/library/bb677334.aspx