I have a time field in db2 named "chgtime" in library "flow", table "changes"
How can I convert this time field, that it only shows me the hour and minute like "14:25" or with text only the hour like "the hour was 14".
For example, if time in one row is e.g. "14:24:05" the output in query should be like "14:25".
For following statement I get only null for all values in chgtime
select varchar_format(varchar(chgtime), 'hh24') as hour_minute from flow.changes
Thank you!
CodePudding user response:
Try this:
select VARCHAR_FORMAT (TIMESTAMP (CURRENT DATE) MIDNIGHT_SECONDS (chgtime) SECONDS, 'HH24:MI')
from flow.changes
