On 1/1/16 4:11 AM, Thomas Kellerer wrote:
You only need to provide the text value to be casted (no format mask).
Use only a single expression without those unnecessary parentheses:
SELECT gmt_date||' '||lpad(gmt_time,8,'0')::timestamp
You don't need the lpad() either:
SELECT gmt_date
On 1/1/16 7:15 AM, Alban Hertroys wrote:
Since you're dealing with GPS data and presumably have lat/long, it shouldn't be hard
to do this dynamically either, either by just blindly dividing longitude by 15 or
using actual timezone shape polygons and @> or <@.
That would be a bad idea for globa
> On 01 Jan 2016, at 0:46, Jim Nasby wrote:
>
> BTW, my recommendation would be to store in a timestamptz field *with the
> correct timezone*, and then convert on output as necessary. This is easy to
> do by either
>
> SET timezone
>
> or
>
> SELECT timestamptz_field AT TIME ZONE '…';
This
gkhan schrieb am 31.12.2015 um 22:34:
Thanks very much for both of your replies. I had tried something similar and
gotten an error, so I am probably making a stupid mistake. If I try this,
it works:
SELECT ('09.03.2014'||' '||lpad('3:00:00',8,'0'),'DD.MM.
HH24:MI:SS')::timestamp
but i
On 12/31/2015 03:05 PM, gkhan wrote:
Follow-up:
My initial question was about oddly-formatted date/times. The suggested
solution of casting directly to timestamp with ::timestamp is not as
flexible as the to_timestamp function that I was trying to avoid. For
example, this fails because of the
On 12/31/15 5:05 PM, gkhan wrote:
For
example, this fails because of the day-before-month format:
Right, which is why Tom had in his example:
regression=# set datestyle = dmy;
BTW, my recommendation would be to store in a timestamptz field *with
the correct timezone*, and then convert on out
Follow-up:
My initial question was about oddly-formatted date/times. The suggested
solution of casting directly to timestamp with ::timestamp is not as
flexible as the to_timestamp function that I was trying to avoid. For
example, this fails because of the day-before-month format:
SELECT ('18.0
On 12/31/2015 01:34 PM, gkhan wrote:
Thanks very much for both of your replies. I had tried something similar and
gotten an error, so I am probably making a stupid mistake. If I try this,
it works:
SELECT ('09.03.2014'||' '||lpad('3:00:00',8,'0'),'DD.MM.
HH24:MI:SS')::timestamp
but if
Oh sorry, what a dumb mistake! ::timestamp works, of course!
Thanks
--
View this message in context:
http://postgresql.nabble.com/to-timestamp-alternatives-tp5879723p5879746.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
--
Sent via pgsql-general mailing list (
On Thu, Dec 31, 2015 at 2:34 PM, gkhan wrote:
> Thanks very much for both of your replies. I had tried something similar
> and
> gotten an error, so I am probably making a stupid mistake. If I try this,
> it works:
>
>SELECT ('09.03.2014'||' '||lpad('3:00:00',8,'0'),'DD.MM.
> HH24:MI:SS
...I meant to add, "and we therefore try to store all time and date values in
'timestamp without time zone' variables.
--
View this message in context:
http://postgresql.nabble.com/to-timestamp-alternatives-tp5879723p5879739.html
Sent from the PostgreSQL - general mailing list archive at Nabble
Thanks very much for both of your replies. I had tried something similar and
gotten an error, so I am probably making a stupid mistake. If I try this,
it works:
SELECT ('09.03.2014'||' '||lpad('3:00:00',8,'0'),'DD.MM.
HH24:MI:SS')::timestamp
but if I use column names instead of the text,
gkhan writes:
> Hi. I have a practical need to convert some badly-formatted date/times into
> 'timestamp without time zone' data types. Like other scientists, I try to
> avoid timezone problems by sticking to UTC and using the 'timestamp without
> time zone' data type whenever possible.
> In t
On 12/31/2015 12:30 PM, gkhan wrote:
Hi. I have a practical need to convert some badly-formatted date/times into
'timestamp without time zone' data types. Like other scientists, I try to
avoid timezone problems by sticking to UTC and using the 'timestamp without
time zone' data type whenever pos
14 matches
Mail list logo