• 0

# Display Current Week Date Range for particular date

## Question

Hi,

We have a date field, and would like to show in Calculated Field from which date to which date this week is. For example, if the date is in 1st week of February 2022, we want to show '01.02.2022 - 06.02.2022'.
Another example:
date: '8 March 2022', calculated value: '07.03.2022 - 13.03.2022'

Is this possible?

## Recommended Posts

• 0

Yes that is possible. First you will need to use the function "DATEPART(dw, [@field:DateField])" which will return integer from 1 to 7, based on which day of the week it is. 1 is Monday, 7 is Sunday.

When you have this value, you can use it in a formula in the next way, "[@calcfield:1]" will be the result of "DATEPART(dw, [@field:DateField])":

Calculate Monday in a given week: "DATEADD(day, -[@calcfield:1]+1, [@field:DateField])"
Calculate Sunday in a given week: "DATEADD(day, 7-[@calcfield:1], [@field:DateField])"

Altogether, without using additional fields, everything can be summed up in one Calculated Field with formula:

'Week from' + space(1) +
+ space(1) +
'to' + space(1) +

Hope this helps.

##### Share on other sites

• 0

Hi - If you would like to show the week number of the year like now (It is currently week 39 in 2023) - this can be done by using calculations.

To use it in Calculated Value, you can use this formula:

`Datepart(week,SysDateTime())`

If you would like to display it in the HTML Block (Details Page), you may use a Calculated Field with this formula:

`Datepart(week,SysDateTime()) - 1`

Hope it helps!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.