Parsing Date/Time From String

This below would parse the string, in the specified format into a valid date time object. STR_TO_DATE only works when the date mask is valid and matches the string passed in. In this example, 201705092301, is a date time with the seconds removed.

select STR_TO_DATE('201705092301', '%Y%m%d%H%i');

Leave a Reply

Your email address will not be published. Required fields are marked *