Thursday, 15 March 2012

postgresql - How do I specify “the start of today” in a specific time zone? -


I have a table with the "Timestamp with time zone" column. I would like to find all the rows whose timestamps are earlier than today, where a certain time zone is set to "today".

I know how is used on the time zone being interpreted in a specific time zone to interpret a literal timestamp, and I know that on this day How to use the date_trunc for the beginning but I'm not sure what to combine to achieve them. I tried

  select date_trunc ('day', at the current time 'CST'); Which gave me "2015-03-16 00:00:00", but it is not clear to me that the time zone has been used (or has one) for this result. How can I choose the start of the current day in a specific time zone?   

Refer me the question to reporter as follows: What is the current date and time in the Central Time Zone? Then, what I need, at the beginning of the day, in midnight [in the middle time zone] I have found that I have it in TIME ZONE 'cst' as

  current_date :: timestamp  I can write as 

No comments:

Post a Comment