Getting Current Week

Yowaraj Chhetri asked on September 7, 2018 03:45

Hi, I have a requirement of creating a field (week date) in a page types which gets the current week date as a default value. This could be done with macro in the default value property but dont know how to do that. Does anyone know how to achieve this or a macro method to get current week date. Week starts from Friday to Thursday. So any page create during that week will have the same week date in the "week date" field. Thanks in advance

Correct Answer

Peter Mogilnitski answered on September 7, 2018 05:40

This will give you the week of the year:{% Floor((DateTime.Now.DayOfYear/7) + 1) |(identity)GlobalAdministrator%},i.e. if you are counting full weeks or not, etc.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Yowaraj Chhetri answered on September 10, 2018 04:33

Thanks, Now I could get week number, which should be fine.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.