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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
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....

1 Solution

Accepted Solutions
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

View solution in original post

28 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Age:

LOAD AGE,

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

TimeStamp(Timestamp#(AGE, 'M/D/YYYY hh:mm:ssTT')) AS Date

FROM

[Age.xlsx]

(ooxml, embedded labels, table is Sheet1);

Regards,

Jagan.

senpradip007
Specialist III
Specialist III

Have a look at this. May be it will help.

tamilarasu
Champion
Champion

Hi,

Check the attachment.

Capture.PNG

bohravanraj
Partner - Creator II
Partner - Creator II

Timestamp(Timestamp#('10/12/1929 12:00:00AM','M/D/YYYY hh:mm:ssTT'),'M/D/YYYY hh:mm:ssTT') Try Above Code

PradeepReddy
Specialist II
Specialist II

try some thing like this...

Age(Date(Today()), Date(Date#(AGE,'M/D/YYYY  hh:mm:ssTT'))) as Age_Yrs

smilingjohn
Specialist
Specialist
Author

HI Tamil Nagraj

Its not working ,

Please find the attachment of the real time data , i tried to use the logic but its not working

smilingjohn
Specialist
Specialist
Author

HI Jagan

Its not working ,

Please find the attachment of the real time data , i tried to use the logic but its not working.

engishfaque
Specialist III
Specialist III

Dear John,

Please use this one,

Table1:

LOAD

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

FROM

Age.xlsx

(ooxml, embedded labels, table is Sheet1);

Kind regards,

Ishfaque Ahmed

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this script;

LOAD ACCNUMBER,

     BATCODE,

     BIRTHDATEODBC,

     COLLDATEODBC,

    

     Age(Now(), TimeStamp(Timestamp#(COLLDATEODBC, Date(Date#(SubField(COLLDATEODBC, ' '), 'M/D/YYYY'))))) AS Age,

     COLLTIMEODBC,

     DIREXAM,

     DRUGCODE,

     DRUGNAME,

     PTNAME,

     DRUGRESULT,

     FINALDATEODBC,

     LOCNAME,

     LOCTYPE,

     MO_GROUPCODE,

     ORDERPHYS,

     ORGANISMCODE,

     ORGCODE,

     ORGDUPFLAG

   

FROM

(ooxml, embedded labels, table is Data);

Regards,

jagan.