Friday, 24 January 2025

Javascript extract time from date string using regex

 const paragraph = '2016-06-06 13:27:39';

const regex = /((?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$)/gm;

const found = paragraph.match(regex);

No comments:

Post a Comment