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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to convert an INT(10) field into a date value

Hi,

I'm working with a Mantis table, but I don't know how to convert a number into a date value.

Looking into the table, all the date values are stored as integer.

When I try to use the date() function, I don't see correct values.

Does anyone help me please ?

Thanks in advance

3 Replies
rphpacheco
Creator III
Creator III

Try:
Date(Date#(DateValue,'DD/MM/YYYY'),'DD/MM/YYYY')

Sokkorn
Master
Master

Hi,

Suppose that your date field store value like:

     a. 20130920 then we need to use Date(Date#(DateField,'YYYYMMDD'),'dd-MM-yyyy')

     b. 20132009 then we need to use Date(Date#(DateField,'YYYYDDMM'),'dd-MM-yyyy')

     c. 20092013 then we need to use Date(Date#(DateField,'DDMMYYYY'),'dd-MM-yyyy')

     d. 09202013 then we need to use Date(Date#(DateField,'MMDDYYYY'),'dd-MM-yyyy')

Above just an idea to get start. BTW, can you share your date field format?

Regards,

Sokkorn

paul_scotchford
Specialist
Specialist

How is the Mantis table stored? If its a SQL table you are trying to load from using a SQL statement then do this...

select

     cast(cast(YourDateField as datetime) as date) as DateFieldName

from

     ...

This assumes the original conversion of the date to Int was performed in SQL