WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ISO 8601 Week Number to Date

 Keywords: ISO 8601 Week Number Date  ISOyyyywwToDate 

#DefineFunction ISOyyyywwToDate(wknr, nday)
;  **************************************************************************************
;  * ISO 8601 weeknumber to date
;  * (i) wknr: 'yyyy:ww',
;  * (i) nday 1,...,7 (1=monday,....,7=sunday), defaults to 1 when not valid
;  * (o) date, or @FALSE if wknr is not valid
;  *
;  * uses: ISOyyyywk(date)
;  *
;  * 2011-02-18 (week 2011:07) Lars M. Doornbos
;  **************************************************************************************
   If nday <1 || nday > 7 Then nday = 1
   yyyy = ItemExtract(1, wknr, ':')
   ww   = ItemExtract(2, wknr, ':')
   yy0  = StrFixLeft(yyyy, '0', 4):':01:04'
   dd0  = ((TimeJulianDay(yy0)+4) mod 7) +1
   jyy0 = TimeJulianDay(yy0)- dd0 +1
   date = TimeJulToYmd(jyy0 +(nday-1) +(ww-1)*7)
   If wknr != ISOyyyywk(date) Then Return
   Return date
#EndFunction

Article ID:   W18406
Filename:   ISO 8601 Week Number to Date.txt
File Created: 2011:02:18:08:43:44
Last Updated: 2011:02:18:08:43:44