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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Date

HI All ,

How to convert dte into age ,

Iam attaching a sample data of xl and QVW file , i want to create one more field by name AGE using the dat field .Can someone help me please

Thanks in Advance....

28 Replies
smilingjohn
Specialist
Specialist
Author

Hi Jagan

Not again its giving  0 value

I dont know whats happening,

PradeepReddy
Specialist II
Specialist II

as per your data, the age function will return '0'. Age function return the no.of years between the 2 dates

if u want to calculate in days, try like this..

today()-Date(Date#(AGE,'M/D/YYYY  hh:mm:ssTT')) as AgeInDays,

age(today(),Date(Date#(AGE,'M/D/YYYY  hh:mm:ssTT'))) as AgeInYrs,

smilingjohn
Specialist
Specialist
Author

Hi Nagraj ,

Iam using your suggested concept in real time where upon i have full data but yet it is showing 0 only .

Look when i was considering just two fields name and date field it is working fine , but when trying to apply on real time its shwoing zero value as shown in the screen shot

smilingjohn
Specialist
Specialist
Author

Pradeep age is the  old file , Now iam trying to apply in real time and i have also attached the sample of real time QVW application where iam not able to get the result for age for the date " CollDateODBC",

PLease fimd the attachment above Dateage.qvw .

Thanks

tamilarasu
Champion
Champion

I can see only two unique dates in your sample file. If it's same, It should work in real data. Could you post your original file.?

Capture.PNG

engishfaque
Specialist III
Specialist III

Dear John,

Have a look into,

LOAD ACCNUMBER,

     BATCODE,

     BIRTHDATEODBC,

     COLLDATEODBC,

     Age(Date(Today(), 'DD/MM/YYYY'), Date(Date#(COLLDATEODBC,'M/D/YYYY  hh:mm:ssTT'), 'DD/MM/YYYY')) as Age,

//     Age(Now(), TimeStamp(Timestamp#(COLLDATEODBC, 'M/D/YYYY  hh:mm:ssTT'))) AS Age,

     COLLTIMEODBC,

     DIREXAM,

     DRUGCODE,

     DRUGNAME,

     PTNAME,

     DRUGRESULT,

     FINALDATEODBC,

     LOCNAME,

     LOCTYPE,

     MO_GROUPCODE,

     ORDERPHYS,

     ORGANISMCODE,

     ORGCODE,

     ORGDUPFLAG

   

FROM

(ooxml, embedded labels, table is Data);

Kind regards,

Ishfaque Ahmed

senpradip007
Specialist III
Specialist III

Please specify the exact output you want. It would be better for us to help.

smilingjohn
Specialist
Specialist
Author

Hi Ahmed

After loading its giving me 0 only

engishfaque
Specialist III
Specialist III

Dear John,

Please check this one,

Age(Date(Today(), 'DD/MM/YYYY'), Date#(Date#(COLLDATEODBC,'M/D/YYYY  hh:mm:ssTT'), 'DD/MM/YYYY')) as Age,


or


Age(Date(Today(), 'DD/MM/YYYY'), Date(Date(COLLDATEODBC,'M/D/YYYY  hh:mm:ssTT'), 'DD/MM/YYYY')) as Age,

Kind regards,

Ishfaque Ahmed