12 Replies Latest reply: Sep 1, 2016 7:05 AM by Adam Brian

# Day_start Function

Hi,

I want to use @day_start function. Can somebody help and tell me how to use that function?

I want to start everyday at 8am. I found this  formula, but i don't know to use it.

"DayStart(time[, [period_no[, day_start]])"

Thanks,

• ###### Re: Day_start Function

try this

DayStart('01-09-2016',1,1/3)

• ###### Re: Day_start Function

Daystart(Now(),1,1/3)

• ###### Re: Day_start Function

I think it is best explained in the help site:

daystart ‒ QlikView

• ###### Re: Day_start Function

can you explain more about "period_no". I'm not really understand about that. As example, I want to start at 8 am everyday and I am able to see the history of the data (> a week ago) . Much appreciate if u can help me to get better understanding.

• ###### Re: Day_start Function

Hi

 period_no period_no is an integer, or expression that resolves to an integer, where the value 0 indicates the day that contains time. Negative values in period_no indicate preceding days and positive values indicate succeeding days.
• ###### Re: Day_start Function

Think of the period_no as an offset which you apply to the timestamp the function evaluates.

Are you trying to return data with a certain date and time range?

like from 29/08/2016 8AM to Today 8AM ?

• ###### Re: Day_start Function

Hi Jonathan,

Yes, this is what i mean.

e.g : I want to look at log's analysis for last week until yesterday. But I want the start time is at 24/08/16 8AM last week until 31/08/16 8AM yesterday.

• ###### Re: Day_start Function

If its in the Load script, we can make use of variables:

LET vDateStart = DayStart(Today()-7,0,0.33333333);

LET vDateEnd = DayStart(Today(),0,0.33333333);

...........

...........

From

......................................

Where

where Date >= '\$(vDateStart)' and Date<'vDateEnd'

;

• ###### Re: Day_start Function

Thank you Jonathan. I will try this first. Will get back to you after i try.

• ###### Re: Day_start Function

From Help file

ExampleResult
daystart('25/01/2013 16:45:00')Returns 25/01/2013 00:00:00.
daystart('25/01/2013 16:45:00', -1)Returns 24/01/2013 00:00:00.
daystart('25/01/2013 16:45:00', 0, 0.5 )Returns 25/01/2013 12:00:00.
• ###### Re: Day_start Function

hi

You got the correct answer?? then mark the Question as answered other wise ask we will try to solve

• ###### Re: Day_start Function

Can you elaborate more on the context in which you are looking for a 8AM day start? This function converts a timestamp to a day start time. Is that actually what you are looking for?