timestamp am/pm

Database

timestamp am/pm

I was trying to convert character to time with am/pm format,

why only when the hour is 00, the format does not work, for example,

select cast('00'||':'||'45'||' '||'am' as time(0) format 'hh:mi bt')

I got invaid time error message.

Thanks

2 REPLIES
Junior Supporter

Re: timestamp am/pm

Hi.

You cannot use '00' hours with AM/PM times.

You must use:

SELECT CAST('12'||':'||'45'||' '||'AM' AS TIME(0) FORMAT 'hh:mibT');

HTH.

Cheers.

Carlos.

Re: timestamp am/pm

Thank you Carlos.