RTollison 0 Posted July 21, 2021 I have a string in an odd format and am needing to change to datetime format. <DateTime>2021-06-25 08:04:09</DateTime> strtodatetime wants the date to be dd/mm/yyyy time is there a strtodatetime that uses a formatdatetime option? Share this post Link to post
Lajos Juhász 293 Posted July 21, 2021 (edited) var ldt: TDateTime; lFormat: TFormatSettings; begin lFormat:= TFormatSettings.Create; lformat.DateSeparator:='-'; lformat.ShortDateFormat:='yyyy-mm-dd'; ldt:=strtodatetime('2021-06-25 08:04:09', lFormat); ShowMessage(DateTimeToStr(ldt)); end; Edited July 21, 2021 by Lajos Juhász Share this post Link to post
RTollison 0 Posted July 21, 2021 thank you, i really appreciate the help. Share this post Link to post