Jan 19, 2024 04:20 AM - edited Jan 19, 2024 04:25 AM
I have a table with work months like here:
I'm trying to calculate the start and end datetimes of the month but the formula is giving inconsistent answers. It's correct for some months but there's an error in End Dates for March, May, July, October and December.
Here is the formula I'm using for Start and End dates:
What am I doing wrong?
Jan 19, 2024 05:50 AM
Hello @Neptune292,
If the formatting options and timezone don't matter for you then use these simple formulas. Like this. Then format the date using default formatting options or using DATETIME_PARSE
Start Date:
DATETIME_PARSE({Work Month})
End Date: Same as your's
DATEADD(DATEADD({StartDate},1,'month'),-1,'second')
The wrong you've done is you minus -7 hours from the current date. Which affects on the next field as well.
See this screenshot with or without that -7 hour.
I hope this helps.
👍
Jan 19, 2024 09:03 PM - edited Jan 19, 2024 09:08 PM
thanks for your response.
timezone matters for me. i'm trying to set the timezone to my timezone that's why I did the minus 7.
I don't know why the formula calculates it correctly for some months but not others
I was able to fix it by setting the End Date to this: