pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQL convert UTC to MST
3+ messages / 3 participants
[nested] [flat]

* SQL convert UTC to MST
@ 2003-12-27 23:37  Seader, Cameron <CSeader@idahopower.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Seader, Cameron @ 2003-12-27 23:37 UTC (permalink / raw)
  To: pgsql-php

I cannot figure this out, and im no SQL guru and would like to do this with an SQL statement if i can. so far here is my SQL statement.

SELECT * FROM t444d500009b5_4_6 ORDER BY utctime DESC

What can i add here to have the column in this table converted from UTC to MST.
any input would be helpful
Thanks,

Cameron Seader
Operations Center Technician II
CSeader@Idahopower.com
1.208.388.2582 Office



[INFO] -- Access Manager:
This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format.  Thank you.   A2





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: SQL convert UTC to MST
@ 2003-12-28 06:04  Michael Fuhr <mike@fuhr.org>
  parent: Seader, Cameron <CSeader@idahopower.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Michael Fuhr @ 2003-12-28 06:04 UTC (permalink / raw)
  To: Seader, Cameron <CSeader@idahopower.com>; +Cc: pgsql-php

On Sat, Dec 27, 2003 at 04:37:32PM -0700, Seader, Cameron wrote:
> I cannot figure this out, and im no SQL guru and would like to do this
> with an SQL statement if i can. so far here is my SQL statement.
> 
> SELECT * FROM t444d500009b5_4_6 ORDER BY utctime DESC
> 
> What can i add here to have the column in this table converted from
> UTC to MST.

What data type is the utctime field?  AT TIME ZONE converts between time
zones, but its use varies depending on the data type you're working with.

http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: SQL convert UTC to MST
@ 2003-12-29 22:02  Steve Crawford <scrawford@pinpointresearch.com>
  parent: Seader, Cameron <CSeader@idahopower.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Steve Crawford @ 2003-12-29 22:02 UTC (permalink / raw)
  To: Seader, Cameron <CSeader@idahopower.com>; pgsql-php

On Saturday 27 December 2003 3:37 pm, Seader, Cameron wrote:
> I cannot figure this out, and im no SQL guru and would like to do
> this with an SQL statement if i can. so far here is my SQL
> statement.
>
> SELECT * FROM t444d500009b5_4_6 ORDER BY utctime DESC
>
> What can i add here to have the column in this table converted from
> UTC to MST. any input would be helpful
> Thanks,

Depends. If the data is an INT (seconds from the epoch) and your 
timezone is set correctly then abstime(utctime) should give you local 
time (adjusted appropriately for Daylight Saving).

What is the data type of utctime?

Cheers,
Steve




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-12-29 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-27 23:37 SQL convert UTC to MST Seader, Cameron <CSeader@idahopower.com>
2003-12-28 06:04 ` Michael Fuhr <mike@fuhr.org>
2003-12-29 22:02 ` Steve Crawford <scrawford@pinpointresearch.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox