Page 1 of 1

Problem with @weekday

Posted: Thu Jun 05, 2014 3:41 am
by shm83
Good afternoon.

I have another problem now :s

I want to generate prices during a period, but only from Mon to Fri. I also need a vector with the dates.
Without that constrain it is easy, I have a vector where the first element could be datesvector(1) = @dateval("03/01/2014"), and price(1) = 150
If I want the whole year from that date, those vectors will have 365-59=306 elements, so I could figure out the date of the price(227) just looking at the date of datesvector(227).

The thing is I want to keep only weekdays in the datesvector, but working in an undefined WF.

I was trying something like

Code: Select all

if @weekday(@datestr(datesvector(1),"DD/MM/YYYY"))=5 then datesvector(2)=datesvector(1)+3 else datesvector(2)=datesvector(1)+1 endif
but @weekday function needs no arguments

Any ideas?

Thanks in advance

Re: Problem with @weekday

Posted: Thu Jun 05, 2014 6:12 am
by trubador

Code: Select all

@datepart

Re: Problem with @weekday

Posted: Thu Jun 05, 2014 8:27 am
by shm83
thank you trubador. I have being also trying with @datediff and I got something "usable", but your way is much better and easier, that is what I was looking for. Thanks again :)