Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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

1 Solution

Accepted Solutions
rbecher
MVP
MVP

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

Astrato.io Head of R&D

View solution in original post

3 Replies
rbecher
MVP
MVP

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

Astrato.io Head of R&D
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

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')