Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date conversion to Number

I need to convert a date field into Numeric.

Num(Date ( 2014/11/12 , 'YYYYMMDD' )  )

output expecting:20141112

The num function giving me the result but not the way I was expecting.Any help on this would be great.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you really want the *numeric* value to be 20141112, then I think it would be done like this:

=num#(Date(Date#('2014/11/12','YYYY/MM/DD') ,'YYYYMMDD'),'0')

-Rob

View solution in original post

10 Replies
Anonymous
Not applicable
Author

Try something like this

Num(Date# ( '2014/11/12' , 'YYYY/MM/DD' )  )

Anonymous
Not applicable
Author

Or maybe even this :

date ( (Date# ( '2014/11/12' , 'YYYY/MM/DD' ), 'YYYYMMDD' ) 

agomes1971
Specialist II
Specialist II

Hi,

see this:

Num(Date#(Field, 'MM/DD/YYYY')) AS NumericDate

Regards

André Gomes

its_anandrjs

Try in place of the NUM with Date#

=Date (Date#('2014/11/12' , 'YYYY/MM/DD' ) ,'YYYYMMDD')

Regards

Anand

shree909
Partner - Specialist II
Partner - Specialist II

Try this

=Date ( Floor(Date# ( '2014/11/12' , 'YYYY/MM/DD' )), 'YYYYMMDD' )

its_anandrjs

Or you can try

=Date(Num(Date# ( '2014/11/12' , 'YYYY/MM/DD' ) ),'YYYYMMDD')

Regards

Anand

ashfaq_haseeb
Champion III
Champion III

Hi,

This should work

=Date(Date#('2014/11/12','YYYY/MM/DD') ,'YYYYMMDD')


Regards

ASHFAQ

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you really want the *numeric* value to be 20141112, then I think it would be done like this:

=num#(Date(Date#('2014/11/12','YYYY/MM/DD') ,'YYYYMMDD'),'0')

-Rob

Not applicable
Author

Thanks Rob.It is always a pleasure to see you here.Yes I wanted to have a numeric value because at the end I am going to comapre this date converted numeric vaule with another Numeric field.Thanks again for your help.