Ken Kennedy <[EMAIL PROTECTED]> writes: > [ date_part('epoch') is wrong for a timestamp value ]
The epoch value is really only correct for a TIMESTAMP WITH TIME ZONE value. If you apply date_part('epoch') to a timestamp without time zone, as you appear to be doing here, what you will get is the epoch for the given value interpreted as GMT. A hack solution is to cast the value to TIMESTAMP WITH TIME ZONE before extracting the epoch; the cast will assume that the given value is local time. But a better idea is to store the column as TIMESTAMP WITH TIME ZONE in the first place. (IMHO, the SQL spec is really brain-dead to define timestamp without time zone as the default form of timestamp; the variant with time zone is much more useful for most applications. It's far too easy to shoot yourself in the foot when working with zoneless timestamps --- usually in a way that you won't notice until daylight-savings transition time comes around, or you roll out the app to users in other time zones.) regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly