Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
george55
Partner - Creator III
Partner - Creator III

Convert Num() to Timestamp

Hi all,

Could not convert a Num-'Date' (eg. 43881) correctly and add a time. Would like to have this format: 'YYYY-MM-DD hh:mm:ss'. (see below output Timestamp1). See below all my trials.

 

Load 
   %DatumId,
   Date(%DatumId, 'DD.MM.YYYY') as Format1, 
   Date(Num(%DatumId, 'DD.MM.YYYY')) as Format2,
   Date(Num#(%DatumId,'#####'), 'DD.MM.YYYY') as Format3,
   Date(Date#(%DatumId, 'DD.MM.YYYY'), 'DD.MM.YYYY') as Format4,   
   Timestamp(StartTime + Date(Num#(%DatumId,'#####'), 'DD.MM.YYYY'), 'YYYY-MM-DD hh:mm:ss') as TimeStamp1,
   Timestamp(TimeStamp#(StartTime & %DatumId, 'YYYY-MM-DD hh:mm:ss')) as TimeStamp2

 

 

2020.0310-101500.jpg

Labels (1)
1 Solution

Accepted Solutions
george55
Partner - Creator III
Partner - Creator III
Author

Find the solution:

TimeStamp(Time#(StartTime, 'hh:mm:ss') + %DatumId, 'YYYY-MM-DD hh:mm:ss') as StartTimeTimeStamp

Problem was the Time and not the integer-Date (43881).
Time was in the format looks like this: '18:00:00'

Hope now I have a real Timestamp.

View solution in original post

1 Reply
george55
Partner - Creator III
Partner - Creator III
Author

Find the solution:

TimeStamp(Time#(StartTime, 'hh:mm:ss') + %DatumId, 'YYYY-MM-DD hh:mm:ss') as StartTimeTimeStamp

Problem was the Time and not the integer-Date (43881).
Time was in the format looks like this: '18:00:00'

Hope now I have a real Timestamp.