Search code examples
sqldatabaseselecth2date-formatting

How to convert time to 24 hour format in H2


Am trying to get current time in 24 hour format in H2 database but it doesn't seem to work I tried select parsedatetime (current_time,'hh24:mm') and select parsedatetime (current_time,'HH24:mm') and others ... but none seems to work

I tried to change the format of windows time but it didn't work also, I guess it's a windows problem, I've posted a question windows not converting to 24 hour format


Solution

  • parsedatetime parses a string to a datetime. You should use formatdatetime:

    SELECT FORMATDATETIME(current_time, 'HH:mm')