[fpc-pascal] Ho to convert a special format of datetime?

2018-12-13 Thread luciano de souza
Hello all, I'd like to convert this date "2017-01-11T17:47:22.2912317-02:00" to TDatetime. It seems probably it exists in Freepascal, but I don't know. So, I ask, how to suply a date in this format and get a TDatetime? I found it in a XPDL file representing a flowchart and I don't know how to do it

Re: [fpc-pascal] Ho to convert a special format of datetime?

2018-12-13 Thread Marco van de Voort
Op 2018-12-13 om 21:07 schreef luciano de souza: Hello all, I'd like to convert this date "2017-01-11T17:47:22.2912317-02:00" to TDatetime. A quick attempt with some standard functions, note that it only parses till millisecond precision, the rest (317) is ignored. uses dateutils,sysutils,s

Re: [fpc-pascal] Ho to convert a special format of datetime?

2018-12-13 Thread silvioprog
On Thu, Dec 13, 2018 at 5:07 PM luciano de souza wrote: > Hello all, > I'd like to convert this date "2017-01-11T17:47:22.2912317-02:00" to > TDatetime. > uses restbase; var d: TDateTime; begin d := RFC3339ToDateTime('2017-01-11T17:47:22.2912317-02:00'); WriteLn(DateTimeToStr(d)); // prin

Re: [fpc-pascal] Ho to convert a special format of datetime?

2018-12-13 Thread luciano de souza
Marco, Sílvio, thank you both. Since a ready function is available, I used RF3339ToDatetime. I received lots of warnings about a possible lost of data due to a string conversion from widestring to ansistring. However, dispite the warnings, the result was perfect. I didn't know scandatetime. Freepas