How to get YYYY-MM-DDThh:mm:ss date format

146 views
Skip to first unread message

Lorenzo Fiorini

unread,
Jun 8, 2015, 5:13:34 PM6/8/15
to harbou...@googlegroups.com
How to get the format YYYY-MM-DDThh:mm:ss from a date?

best regards,
Lorenzo

Maurizio la Cecilia

unread,
Jun 8, 2015, 6:14:12 PM6/8/15
to harbou...@googlegroups.com
Hi Lorenzo,
did you try with:

hb_TtoC( date, "YYYY-MM-DD", "hh:mm:ss" ) ?   

It returns "YYYY-MM-DD hh:mm:ss" .
It lacks of the "T" separator and, obviously, the time is set always to "00:00:00".

Best regards,
Maurizio

Klas Engwall

unread,
Jun 8, 2015, 6:37:35 PM6/8/15
to harbou...@googlegroups.com
Hi Lorenzo,

> How to get the format YYYY-MM-DDThh:mm:ss from a date?

This works, but I don't know if it is the best solution:

left( stuff( hb_tstostr( hb_datetime() ), 11, 1, 'T' ), 19 )

Regards,
Klas

Lorenzo Fiorini

unread,
Jun 9, 2015, 6:05:36 AM6/9/15
to harbou...@googlegroups.com
On Tue, Jun 9, 2015 at 12:37 AM, Klas Engwall <har...@engwall.com> wrote:

> This works, but I don't know if it is the best solution:
>
> left( stuff( hb_tstostr( hb_datetime() ), 11, 1, 'T' ), 19 )

Many thanks Klas and Maurilio.
I didn't find a specific function and I wanted to be sure I didn't miss sth.

best regards,
Lorenzo
Reply all
Reply to author
Forward
0 new messages