Forum Discussion
Date.parse(Date.now().toLocaleDateString({"timeZone":"America/Los_Angeles"})).getTime()
So that is the first thing I tried, but it gives me a UTC DateTime object at 00:00:00 for the Date, and calls getTime() on it. You cannot call getTime() without the Date.parse() which turns it into a UTC timezone because toLocalDateString() and toLocalDateTimeString() both return a datetime string WITHOUT the timezone or offset. Even though the snaplogic documentation says you can provide a ‘x’ or a ‘z’ in the ‘format’ parameter the result doesn’t contain any timestamp information for Date.parse() to understand. I even tried appending the timezone information to what is passed into the Date.parse() with no luck.
This will result in a UTC Y-m-d 00:00:00 timestamp.
I need a America/Los_Angeles Y-m-d 00:00:00 timestamp. If I used the above, I will be off by whatever the offset is in the America/Los_Angeles timezone.
Related Content
- 3 months ago
- 2 years ago