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: 
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