Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to handle daylight savings time when calculating time/date

Hello everyone! I have run across an interesting issue. I created a form which my users use a calendar pull down to select a date in the future. When they select the start date, I calculate the end date for 7 days later and adding an additional 7 hours to the end date so the end time would show 2022-02-07 07:00.

When my users select 2022-03-07 as a start date the end date gets set 

2022-03-14 08:00

when it should be 2022-03-14 07:00.

Since our daylight savings time starts 2022-03-13 I'm wondering how I can programmatically work this field calculation for this one specific issue. I know this is also probably going to happen when our DST ends. So is there any way I can fix this little annoyance?

This is how I set the field.....

OnCallEnd=[entry.BeginDate.timestamp.add(604800000+25200000).formatDate(yyyy-MM-dd HH:mm)]

the 604800000 is 7 days ahead and the 25200000 is 7 hours ahead. I tried to set the timezone to the formatDate but that didn't help.

Any help in this little annoyance would be appreciated.




2 answers


Honestly, I am quite puzzled by this complexity and probably not getting the whole reasoning behind it, but...

If you know when you need to calculate the end date adding another hours then I suggest to make the calculation conditional, based on that.

So, basically having two functions - one that calculates your end date before the certain date and another one that calculates it after


0 votes
Bill Bailey Community Leader Dec 08, 2021

Is this via a user macro? In other words, is the calculation rendered each time the page is refreshed?

Does your server time adjust for DST? In other words, can you detect the change by the server time zone marker?

Otherwise, you either have to a) live with the edge cases 2 weeks out of the year, or b) you have to programmitaclly keep track of the dates the times change and do your own adjustment (not pretty, but workable).

This is within confiforms and not a user macro. The calculation is done when the date dialog is closed and it then performs the calculations based upon the data I have provided. I don't know if confiforms uses it own method of determining daylight savings or if they rely on confluence to do this. All I know is it starts one week before the actual time change takes place. But I'm just worried about monday as this is the specific day users are allowed to select.

This is a minor annoyance and I've just notified my users to watch out for this twice a year.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

961 views 7 42
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you