Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

jocampbell
New Contributor II

How to compare time part of timestamps

Hello,

I'm trying to create some courier delivery codes from timestamps but am struggling to figure out the correct date/time functions to use.

So for example, if a timestamp has a time part of 9am, the delivery code is '9AM'. Similarly, if a timestamp is before 12pm (and not equal to 9am) then the code is 'AM'.

For the 9am code I have tried a few things like the below but none of them give the expected result....

If(Time(Timestamp(PromisedDelivery, 'hh:mm')) = MakeTime(9), '9AM', 'Other')

Can anyone point me in the right direction?

Tags (2)
1 Solution

Accepted Solutions
lironbaram
Honored Contributor II

Re: How to compare time part of timestamps

hi

as timestamp is a number

you could do something like

if(frac(PromisedDelivery)*24=9 ,'9AM','Other')

if find it much more easy to  compare two integers

2 Replies
lironbaram
Honored Contributor II

Re: How to compare time part of timestamps

hi

as timestamp is a number

you could do something like

if(frac(PromisedDelivery)*24=9 ,'9AM','Other')

if find it much more easy to  compare two integers

jocampbell
New Contributor II

Re: How to compare time part of timestamps

Brilliant. Thank you!! :-)

Community Browser