Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My date fields are separated and the first step is to combine them. The code below works successfully.
EventDate,
StartTimeHour as ALT_StartTimeHour,
StartTimeMinute as ALT_StartTimeMinute,
StartTimeAM_PM as ALT_StartTimeAM_PM,
timestamp#(EventDate & ' ' & num(StartTimeHour,'00')
& ':' & num(StartTimeMinute,'00')
& ' ' & StartTimeAM_PM,'MM-DD-YYYY h:mm TT' ) as ALT_EventDate,
The output is in the AM/PM format, but I need the 24 hour format.
In a preceding load I have tried various timestamp and date functions. For example, the code below returns a null value.
timestamp#(ALT_EventDate,'MM-DD-YY h:mm') as ALT_EventDate2,
Try TimeStamp() instead of TimeStamp#()
TimeStamp(ALT_EventDate,'MM-DD-YY h:mm') as ALT_EventDate2,
Hi,
referring to this link:
Convert 12 Hour to 24 Hour Timestamp
try Manish and Tresesco suggestions
TimeStamp(Timestamp#(ALT_EventDate,'DD/MM/YYYY hh:mm:ss TT'),'DD/MM/YYYY hh:mm:ss') as ALT_EventDate
OR
SET TimestampFormat='DD-MM-YYYY hh:mm:ss[.fff]';
TimeStamp(Timestamp#(ALT_EventDate, 'DD/MM/YYYY hh:mm:ss TT')) as ALT_EventDate
I think the issue was that I was using '-' as a date separator as opposed to '/'. The solution from Youssef works.