SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Calculating weeknumber

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Calculating weeknumber
Author Message
Robbert de GROOT



Joined: 13 Dec 2000
Posts: 53

Post Calculating weeknumber Reply with quote

Hello

Is there a ready-to-use function (couldn't find it)
in 24x7 to calculate the (international) weeknumber ?

Thanks
RObbert de GROOT

Mon Oct 10, 2005 8:10 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Calculating weeknumber Reply with quote

In VBScript job you can use DataPart() with "ww" parameter for the part.
In JAL you can do something like the the following:

Dim given_date, date
Dim start_of_year, date
Dim year, number
Dim days, number
Dim weeks, number

DateTimePart( "yy", given_date, year )
MakeDate( year, 1, 1, start_of_year )
DaysBetween( given_date, start_of_year, days )
Divide( days, 7, weeks )

Dim day1, number
Dim day2, number
Dim week_offset, boolean
DateTimePart( "dw", given_date, day1 )
DateTimePart( "dw", start_of_year, day2 )
Subtract( day1, day2, days )
IsGreater( days, 0, week_offset )

If( week_offset, DO1, DO2 )
DO1:
Ceiling ( weeks, weeks )
GoTo DONE
DO2:
Floor( weeks, weeks )
DONE:

// weeks - this is your number

You can wrap this code as a user-defined statement and then call it as if it was a built-in method

: Hello

: Is there a ready-to-use function (couldn't find it)
: in 24x7 to calculate the (international) weeknumber ?

: Thanks
: RObbert de GROOT

Mon Oct 10, 2005 8:56 am View user's profile Send private message
Robbert de GROOT



Joined: 13 Dec 2000
Posts: 53

Post Re: Calculating weeknumber Reply with quote

ok, thanks. But where does the function DaysBetween
com from ? Is it a standard JAL fuction ?

: In VBScript job you can use DataPart() with "ww" parameter for the
: part.
: In JAL you can do something like the the following: Dim given_date, date
: Dim start_of_year, date
: Dim year, number
: Dim days, number
: Dim weeks, number

: DateTimePart( "yy", given_date, year )
: MakeDate( year, 1, 1, start_of_year )
: DaysBetween( given_date, start_of_year, days )
: Divide( days, 7, weeks )

: Dim day1, number
: Dim day2, number
: Dim week_offset, boolean
: DateTimePart( "dw", given_date, day1 )
: DateTimePart( "dw", start_of_year, day2 )
: Subtract( day1, day2, days )
: IsGreater( days, 0, week_offset )

: If( week_offset, DO1, DO2 )
: DO1: Ceiling ( weeks, weeks )
: GoTo DONE
: DO2: Floor( weeks, weeks )
: DONE: // weeks - this is your number

: You can wrap this code as a user-defined statement and then call it as if it
: was a built-in method

Mon Oct 10, 2005 9:37 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Calculating weeknumber Reply with quote

I meant DaysAfter instead of DaysBetween

: ok, thanks. But where does the function DaysBetween
: com from ? Is it a standard JAL fuction ?

Mon Oct 10, 2005 9:43 am View user's profile Send private message
Robbert de GROOT



Joined: 13 Dec 2000
Posts: 53

Post Re: Calculating weeknumber Reply with quote

I tried to find the function DaysAfter but even wioth the latstes
version (3.4.26) the script doesn't support the execution of the
DaysAfter function

Did I forget something or ...

: I meant DaysAfter instead of DaysBetween

Tue Oct 11, 2005 9:23 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Calculating weeknumber Reply with quote

Please try DateTimeDiff and then devide the ruturned number by 3600

Example:

DateTimeDiff date1, date2, seconds
Divide seconds, 3600, days
Floor days, days

: I tried to find the function DaysAfter but even wioth the latstes
: version (3.4.26) the script doesn't support the execution of the
: DaysAfter function

: Did I forget something or ...

Tue Oct 11, 2005 5:46 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.