+ Start a Discussion
ARCHIT PathakARCHIT Pathak 

Calculate number of days between saturday and sunday.

Hi,

I'm trying to calculate the number of days between Saturday and Sunday by using daysBetween(toStartofWeek).

If it's 0, I count it as a Sunday, if it's -6, I count it as a Saturday.

This was working fine until I saw this link and changed the user locale

https://help.salesforce.com/articleView?id=admin_supported_date_time_format.htm&type=5

Now as per this post, for some locales 0 will be Monday and for some -6 will be a Friday.

I thought of using a map, but I'm already using one to set locale adjusted date format.

Can anyone help me in resolving this as per logged in user's locale(which I am getting correctly)?

RovRov
if you haven't looked, this blog post might help you - 
https://laceysnr.com/user-locales-and-the-start-of-the-week/