How to get the Unix Timestamp for 00:00:00 and 23:59:59 of the previous day in Make.com?

I am using Make.com to automatically fetch order data from an API on a daily basis. I need to get the Unix Timestamp for 00:00:00 and 23:59:59 of the previous day.

My Requirements:

  • startDateTime should be 00:00:00 of the previous day as a Unix Timestamp.
  • endDateTime should be 23:59:59 of the previous day as a Unix Timestamp.
  • The formula must work correctly regardless of when the scenario runs.

What I have tried but didn’t work:

  1. :x: Keeps the current time of now instead of resetting to 00:00:00

make

Sao chépChỉnh sửa

{{formatDate(addDays(now; -1); "X")}}
{{formatDate(addSeconds(addDays(now; -1); 86399); "X")}}
  • Issue: The returned timestamp does not represent 00:00:00 but retains the hour from now.
  1. :x: Concatenating the date with 00:00:00 and using parseDate()

make

Sao chépChỉnh sửa

{{formatDate(parseDate(formatDate(addDays(now; -1); "yyyy-MM-dd") & " 00:00:00"; "yyyy-MM-dd HH:mm:ss"); "X")}}
  • Issue: " 00:00:00" is not a valid date or does not match the date format.

I need help to get the correct formula!

Does anyone have a correct and optimal way to retrieve the Unix Timestamp for 00:00:00 and 23:59:59 of the previous day in Make.com?

Thanks a lot for your help!

Hi @Thanh_Nguyen - welcome to the Community!

I’ve not tested it, but I think you should be able to do this with a combination of addDays(), setHour(), setMinute() and setSecond().

Something like:

setSecond(setMinute(setHour(addDays(now; -1);0);0);0)

4 Likes

Hi DavidGurr_Make,

Thank you so much! Your solution works perfectly and helped me resolve the issue. I really appreciate your support! :rocket::tada:

Thanks again! :blush:

1 Like

You’re very welcome! Happy Making!

1 Like