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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

help with timestamp

Hi All,

I have a field with a timestamp, the values of this field are formatted like this...

1306052300376

This is broken up as follows..

13 = Year

06 = Month

05 = Day

23 = Hour

00 = Mins

37 = Secs

6 = Extract counter (I want to ignore this)

How can i reformat these in the script to be a seperate date field (DD/MM/YYYY) and a seperate time field (hh:mm)

Any help would be great

Labels (1)
1 Solution

Accepted Solutions
rbecher
Partner - Master III
Partner - Master III

Hi,

you can use:

date(date#(left(1306052300376, 6), 'YYMMDD'), 'DD/MM/YYYY')    ..for date

=time(time#(mid(1306052300376, 7, 4), 'hhmm'), 'hh:mm')    ..for time

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

3 Replies
rbecher
Partner - Master III
Partner - Master III

Hi,

you can use:

date(date#(left(1306052300376, 6), 'YYMMDD'), 'DD/MM/YYYY')    ..for date

=time(time#(mid(1306052300376, 7, 4), 'hhmm'), 'hh:mm')    ..for time

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
eduardo_sommer
Partner - Specialist
Partner - Specialist

MakeDate('20'&Mid(Field,1,2),Mid(Field,3,2),Mid(Field,5,2)) as NewDate

MakeTime(Mid(Field, 7,2), Mid(Field, 9,2), Mid(Field,11,2)) as NewTime

Where Field is the name of the field with the timestamp (substitute for your field)

Eduardo

its_anandrjs
Champion III
Champion III

In load script load a table like below

LOAD *,

Date(Date#(Left(OldDate,6),'YYMMDD'),'DD/MM/YYYY') as NewDate,

Time(Time#(Mid(OldDate,7,6),'hhmmss'),'hh:mm:ss') as NewTime;

LOAD * Inline

[

OldDate

1306052300376

];

Or in front end try with this in any text object

For Date

Date(Date#(Left(1306052300376,6),'YYMMDD'),'DD/MM/YYYY')

For Time

Time(Time#(Mid(1306052300376,7,6),'hhmmss'),'hh:mm:ss')