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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

To get next day 10 AM

Hi All,

I have a field call Start Time as MM/DD/YYYY hh:mm:ss. I want a logic if the time is > 17:00:00, then it will return next day 10:00:00.

Like if the values is    25-06-2018  22:09:00, then it should show    26-06-2018  10:00:00.

Can you please help me to do this in script.

Thanks,

Sarif

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Sorry, just realized that your date format is different then what it comes in as... may be if you Start Time is not read properly, you might need TimeStamp#() function to help Qlik understand your timestamp field

TimeStamp(If(Hour(TimeStamp#([Start Time], 'MM/DD/YYYY hh:mm:ss')) > 17, Floor(TimeStamp#([Start Time], 'MM/DD/YYYY hh:mm:ss')) + 1 + MakeTime(10), TimeStamp#([Start Time], 'MM/DD/YYYY hh:mm:ss')), 'DD-MM-YYYY hh:mm:ss') as  [Start Time]

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

May be this

TimeStamp(If(Hour([Start Time]) > 17, Floor([Start Time]) + 1 + MakeTime(10), [Start Time])) as  [Start Time]

sunny_talwar
MVP
MVP

Or you can specify the format with TimeStamp

TimeStamp(If(Hour([Start Time]) > 17, Floor([Start Time]) + 1 + MakeTime(10), [Start Time]), 'DD-MM-YYYY hh:mm:ss') as  [Start Time]

sunny_talwar
MVP
MVP

Sorry, just realized that your date format is different then what it comes in as... may be if you Start Time is not read properly, you might need TimeStamp#() function to help Qlik understand your timestamp field

TimeStamp(If(Hour(TimeStamp#([Start Time], 'MM/DD/YYYY hh:mm:ss')) > 17, Floor(TimeStamp#([Start Time], 'MM/DD/YYYY hh:mm:ss')) + 1 + MakeTime(10), TimeStamp#([Start Time], 'MM/DD/YYYY hh:mm:ss')), 'DD-MM-YYYY hh:mm:ss') as  [Start Time]

mhmmd_srf
Creator II
Creator II
Author

Thank Sunny...I did in below way and it is working..

Date(Timestamp(DayStart((Date([Start Time]+1)))+10/24),'MM/DD/YYYY hh:mm:ss')