Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
duhita
Contributor
Contributor

Extracting Month from existing field

How to extract date, month and year from existing field?

For example, I have 1 field for date and time but the format is : DD/MM/YY HH.MM.SS

and the data is imported from a database.

How can I extract the date, month and year based on the existing field into 3 new fields?

1 Reply
anthonyj
Creator III
Creator III

Hi @duhita ,

You can use the timestamp#() function which interprets the incoming data in the way you outline in the second parameter.

As per your example:

date(timestamp#([Date field], 'DD/MM/YY hh.mm.ss')) as [Date]

month(timestamp#([Date field], 'DD/MM/YY hh.mm.ss')) as [Month]

Year(timestamp#([Date field], 'DD/MM/YY hh.mm.ss')) as [Year]

Documentation on reading in date times

https://help.qlik.com/en-US/sense/May2022/Subsystems/Hub/Content/Sense_Hub/Scripting/InterpretationF...

I hope this makes sense.

Regards

Anthony