Access (T-SQL) Convert week 53 to week 01


/ Published in: SQL
Save to your folder(s)

The week function produces week numbers 1 to 52, starting from the first Sunday in the year (week runs Sunday to Saturday). Rather than rolling over the remaining few days in the year to week 01, the function produces week 53 which is not a full week. This code therefore ensures you always have 52 full weeks, albeit a few days may not be in the same year.


Copy this code and paste it in your HTML
  1. Week*: IIf(Format([DateField],"ww")=53,"Wk 1-" & Format([DateField],"yyyy")+1,"Wk " & Format([DateField],"ww-yyyy"))

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.