I’m trying to format a bunch of date ranges to be used in WORKDAY().
I created a script that collects these dates from a base and have them converted to iso-dates.
However all my dates has a trailing time stamp of T00:00:00.000Z.
Wondering if there is a quick way to omit of the time stamp so it’s only YYYY-MM-DD?
Well, there are as many ways to do this as there are to compute your personal tax liability, but… I’m lazy so when dealing with predictable strings - like an ISO date - I just do this:
Given this:
let isoDate = "2016-05-24T15:31:48.335Z";
I would simply:
let dateOnly = isoDate.split("T")t0];
Javascript experts would probably spit on my grave for suggesting this. But in a sanitized environment like Script Blocks, I’m not actually sure what level of date formatting support exists.
Well, there are as many ways to do this as there are to compute your personal tax liability, but… I’m lazy so when dealing with predictable strings - like an ISO date - I just do this:
Given this:
let isoDate = "2016-05-24T15:31:48.335Z";
I would simply:
let dateOnly = isoDate.split("T")t0];
Javascript experts would probably spit on my grave for suggesting this. But in a sanitized environment like Script Blocks, I’m not actually sure what level of date formatting support exists.
@Bill.French Thank you for this.
I’m all for being lazy and I thought there would be a ‘dirty’ simple way to do this without involving splitting the date into subpart and putting them together again, or trying to hack together some regEx.
Just a bit ashamed I didn’t see this solution myself.
Thanks again
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.