Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Shabnam123
Contributor II
Contributor II

Load Data as Timestamp

How do I correctly Load my Data as Timestamp on Qlik?
My data is of this format:  2023-12-19T12:36:53.630

I need to Load data as a timestamp. Also, how do I create a query segregating the Data and time into 2 different columns on Qlik?

 

Labels (2)
2 Replies
BrunPierre
Partner - Master
Partner - Master

Try these.

Timestamp(Timestamp#(FieldName,'YYYY-MM-DDThh:mm:ss.fff'),'YYYY-MM-DD hh:mm:ss') as DateTime,
Date(Floor(Timestamp#(FieldName),'YYYY-MM-DDThh:mm:ss.fff'),'YYYY-MM-DD') as Date,
Time(Frac(Timestamp#(FieldName),'YYYY-MM-DDThh:mm:ss.fff'),'hh:mm:ss') as Time,

maxgro
MVP
MVP

if you have a text field (date and time as text)

Table1:
load
Text(Date(makedate(2022) + rand()*1000, 'YYYY-MM-DD') & 'T' & Time(rand(), 'hh:mm:ss.fff')) as Text_Field
AutoGenerate 1000;
 
 
you can use
- an interpretation function (Timestamp#) to convert the text field to timestamp
- then Floor for the date part of a timestamp and Frac for the time part
 
Table2:
LOAD
Text_Field,
Timestamp_Field,
Date(Floor(Timestamp_Field)) as Date_Field,
Time(Frac(Timestamp_Field)) as Time_Field
;
LOAD
Text_Field,
Timestamp#(replace(Text_Field, 'T', ' '), 'YYYY-MM-DD hh:mm:ss.fff') as Timestamp_Field
Resident
Table1;
 
you can find a more detailed explanation here
 
maxgro_1-1718726318447.png