We are deploying our own flow sensors (which is very similar to this USGS indicator: http://waterdata.usgs.gov/usa/nwis/uv?site_no=03539600 ) so that we, kayaks, know if there is enough water to row a stream and donβt waste time and gas driving there. We hope to establish several of them in the southeastern part of whitewater, which covers the eastern and central time zones.
I save the time when the record is inserted using the default current_time for the record. I would like to display the data later using the format MM/DD/YYYY HH12:MI AM TZ
, which outputs as 03/12/2012 01:00 AM CDT
. I would also like the output to be noticeable in daylight, so the last part of the previous sentence would change between CST and CDT when we βw760> forwardβ and βback offβ. This change occurred on 11/11/2012 this year, and I have included dates on either side of this DST line below. I use a laptop for Windows 7 for development, and we will later deploy it in a Unix box. Postgres seems to have detected that my Windows computer is installed in the eastern US time zone. I am trying to do this with the "timestamp without time zone" field and the "timestamp with time zone" field, but cannot make it work.
I tried to use "in time zone" in my settings, and everything works until it shows the time zone. The actual hour is part of the timestamp correctly deducted by the hour when I ask for time in the CDT. But EDT is displayed on output.
SELECT reading_time as raw, reading_time at time zone 'CDT', to_char(reading_time at time zone 'CDT', 'MM/DD/YYYY HH12:MI AM TZ') as formatted_time FROM readings2; "2012-04-29 17:59:35.65";"2012-04-29 18:59:35.65-04";"04/29/2012 06:59 PM EDT" "2012-04-29 17:59:40.19";"2012-04-29 18:59:40.19-04";"04/29/2012 06:59 PM EDT" "2012-03-10 00:00:00";"2012-03-10 00:00:00-05";"03/10/2012 12:00 AM EST" "2012-03-11 00:00:00";"2012-03-11 00:00:00-05";"03/11/2012 12:00 AM EST" "2012-03-12 00:00:00";"2012-03-12 01:00:00-04";"03/12/2012 01:00 AM EDT"
I save the time zone so that each of our sensors is in the field with a variable symbol separately. I thought I was just adding this value to the end of the time output, but I want it to change from CST to CDT without my intervention.
Thanks for your help.
source share