Prakhar Mishra
Prakhar Mishra

Reputation: 1814

Date formatting options in HANA

I am trying to convert date column to this format: May 28, 2018 2:44:47.883 PM. I am using this query to do that:

SELECT
CURRENT_TIMESTAMP,
TO_NVARCHAR(CURRENT_TIMESTAMP, 'Mon DD, YYYY HH:MM:ss')
FROM Dummy

But, no luck yet. What date formatting options are available in HANA?

Edit

Query output:

May 29, 2018 1:53:13.055 PM       May 29, 2018 01:05:13

As you can see, MM is being considered as month instead of minutes. And I have no idea how can I ask for 3-digit milliseconds, following by AM / PM.

Upvotes: 2

Views: 15037

Answers (1)

Nelson Miranda
Nelson Miranda

Reputation: 5564

Please try 'Mon DD, YYYY HH:MI:SS'.

From SAP HANA documentation:

TIME

The TIME data type consists of hour, minute, and second information to represent a time value. The default format for the TIME data type is HH24:MI:SS. HH24 represents the hour from 0 to 24, MI represents the minute from 0 to 59, and SS represents the second from 0 to 59.

Upvotes: 1

Related Questions