I'm trying to find a smart way to clean this content up "date2022-01-09T15:33:24.785Z" automatically. The output I'm looking for is the date, "2022-01-09".
Any ideas?
If the heading wasn't clear enough. I have a google sheet that updates automatically, but I'm having trouble with the format of the input in one och the columns, where I only want the date.
CodePudding user response:
"date2022-01-09T15:33:24.785Z".split(/[a-zA-z]/g).filter(e => e)[0];
CodePudding user response:
Try:
'date2022-01-09T15:33:24.785Z'.match(/date([^A-Z]*)/)[1]
