Re: select to_timestamp('02/26/2011 14:50', 'MM/DD/YYYY HH24MI')

From: Reid Thompson <Reid(dot)Thompson(at)ateb(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: select to_timestamp('02/26/2011 14:50', 'MM/DD/YYYY HH24MI')
Date: 2011-02-25 14:41:54
Message-ID: 4D67BFB2.4060906@ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/25/2011 09:30 AM, akp geek wrote:
> Hi all -
>
> I have recently upgraded from 8.3 to 9.0.2.
>
> when I run the following sql in 9.0.2 " select to_timestamp('02/26/2011 14:50', 'MM/DD/YYYY HH24MI') " I am getting the following
> error and the sql runs fine in older version
>
> Is it my installation issue or library missing?
>
>
> ERROR: invalid value ":5" for "MI"
> DETAIL: Value must be an integer.
>
> ********** Error **********
>
> ERROR: invalid value ":5" for "MI"
> SQL state: 22007
> Detail: Value must be an integer.
>
>
>
> Thanks for the help
> Regards

military time doesn't have the ':' in the HHMM.
look closely at your 'working' result, does it look like this?

reporting=# select to_timestamp('02/26/2011 14:50', 'MM/DD/YYYY HH24MI');
to_timestamp
------------------------
2011-02-26 14:00:00-05
(1 row)

reporting=# select to_timestamp('02/26/2011 1450', 'MM/DD/YYYY HH24MI');
to_timestamp
------------------------
2011-02-26 14:50:00-05
(1 row)

Note the invalid time for the first result.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message akp geek 2011-02-25 14:47:32 Re: array size
Previous Message David Johnston 2011-02-25 14:40:01 Re: The scope of sequence