Convert December 23, 2023 to 231223 (YYMMDD format)

Hello. Here’s what I’m trying to do:

Column A: Date column set to Date Only > Medium format or “December 23, 2023”
Column B: need to get/copy the values in Column A (each row separately), convert these values from “December 23, 2023” to “231223” and then write the converted value to Column B (for all rows individually)

My assumption is using a Math column would be the most efficient using a formula, but I don’t have any idea what the formula would be? Any help would be greatly appreciated. Thx

Mod(Year(Date),2000)*10^4
+ Month(Date)*10^2
+ Day(Date)

ps. I should add that the above won’t work for dates prior to 2000, or after 2099. But if you have dates outside that range, then using YYMMDD format is going to break anyway.

If you want something that works for all dates, then I’d recommend YYYYMMDD format, in which case the formula would be:

Year(Date)*10^4
+ Month(Date)*10^2
+ Day(Date)
3 Likes

Or you can use the format date column:

1 Like

Not recommended, as it’s known to give inconsistent results on some devices under some circumstances.

same as math…but i agree that math column for some reason, handles this better… that’s why I always trust the Javascript column the most… i get the current time from Java and then all the formating goes from there

@Darren_Murphy and @Uzo Thank you both for taking the time share your expertise and responding so quickly! This is a huge help. Too bad the Format Date function doesn’t work consistently as that’s a little more straightforward for us non-formula lads. :slight_smile:

Darren, the formula with YYYY works perfect…thanks again, much appreciated.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.