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: 
Not applicable

Help in converting cron expression into date format

Hi,

I have data column which contains cron expression.  I would like to convert into date format when I display it.

Can someone help with the conversion?

For ex. -  "0 15 13 28 9  ? 2015" to  "2015/09/28, 01:15 PM"

Thanks,

Nili

3 Replies
Anonymous
Not applicable
Author

Here you go:

timestamp(timestamp#('0 15 13 28 9  ? 2015','s mm hh DD M  ? YYYY'))

Not applicable
Author

Thanks for the quick response. 

It works for above cron expression, but what should I do for other types of cron expression (daily,monthly,weekly) which has different syntax like

0 15 8 ? * *  ( which means daily 8:15 AM)

or

0 30 8 1 * ? ( which means monthly on 1st day at 8:30 AM)

Also,

I am trying to put this in if condition like

 

if(WildMatch(CRON_EXPRESSION, 's mm hh DD M ? YYYY'), timestamp(timestamp#(CRON_EXPRESSION,'s mm hh DD M ? YYYY')), CRON_EXPRESSION) as converted_cron_expression

then it does not work.  It does not convert into Timestamp format.  Any idea what am I doing wrong?

Thanks,

Nili

amars
Specialist
Specialist

Hi Nilli,

WildMatch won't help in this case as it is used for the String Comparison & not for format comparison. Rather try using some other string functions like SubstringCount(CRON_EXPRESSION)to identify the no of spaces in between the string. which should help identify the format of the string that you need.

Thanks

Amar