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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting timestamp

Hi All,

Is it possible to compare the date time format of a field?

e.g. if datetime format is in DD-MM-YYY hh:mm:ss TT, then 'Y'  else 'N' in the field Check should be created.

Thanks,

Asma

9 Replies
sunny_talwar

You might be able to do this:

If(IsNum(Num(Date#(YourDateField, 'DD-MM-YYY hh:mm:ss tt'))), 'Y', 'N')

Best,

Sunny

anbu1984
Master III
Master III

=If(IsNum(Timestamp#('01-01-2010 01:10:10 AM','DD-MM-YYYY hh:mm:ss TT')),'Y','N')

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Arriving a flag in script will have better performance in front end.

LOAD

*,

If(TimeStamp#(DateFieldName, 'DD-MM-YYY hh:mm:ss TT'), 'Y', 'N') AS Flag

FROM DataSource;

Now use this flag in set analysis like below

Count({<Flag={'Y'}>} SomeDimension)

Regards,

Jagan.

Anonymous
Not applicable
Author

Hi Asma,

You can check the Date Format or Date-Time Format with the help of Alt function.

Please refer to attached image for detail:

Check Date Format.PNG

Thanks & Regards
Prince Anand

Not applicable
Author

Is it possible to get the DateFieldName from a variable?

e.g. If I use

let vColumnName=FieldName(1,'Test') as [Column Names]

vColumnName would store the column name.

Now can I use the below expression for checking the datetime format


If(TimeStamp#(vColumnName, 'DD-MM-YYY hh:mm:ss TT'), 'Y', 'N') AS Flag

Anonymous
Not applicable
Author

Yes Asma You can get the column name by using fieldname function and store it in a variable like show below:

set vStartDate=makedate(2015,05);

Calendar:

load date($(vStartDate)+RecNo()-1,'DD-MM-YYYY') as Date

AutoGenerate makedate(2015,05,15)-$(vStartDate)+1;

let vColName=fieldname(1,'Calendar');

and then use the alt function as describe above.

Thanks & Regards

Prince Anand

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

If(TimeStamp#($(vColumnName), 'DD-MM-YYY hh:mm:ss TT'), 'Y', 'N') AS Flag


Regards,

jagan.

Not applicable
Author

The above expression is not working.

It always returns N

anbu1984
Master III
Master III

Can you post sample input