Recent

Author Topic: Help conversion string UTC to Datetime  (Read 1400 times)

critter

  • New member
  • *
  • Posts: 14
Help conversion string UTC to Datetime
« on: April 19, 2018, 01:45:43 pm »
Hello everyone, I am new to the forum and first to the lazarus team for their effort and congratulations for a wonderful product.

Then ask for your help, since I have to convert a string of the type "2017-04-03T20: 43: 02 + 02: 00" to datetime and I do not know how. Can someone help me?
 Thank you.

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: Help conversion string UTC to Datetime
« Reply #1 on: April 19, 2018, 01:54:40 pm »
strtodatetime does not work?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

critter

  • New member
  • *
  • Posts: 14
Re: Help conversion string UTC to Datetime
« Reply #2 on: April 19, 2018, 02:01:01 pm »
generates the exception that is not a valid time

Thaddy

  • Hero Member
  • *****
  • Posts: 8182
Re: Help conversion string UTC to Datetime
« Reply #3 on: April 19, 2018, 02:05:45 pm »
Quote
2017-04-03T20: 43: 02 + 02: 00
You need to replace both the T with a space and the + because that format is not supported.
What is the original language? There are options to convert based on localization, but I need to know the language.
Read the manuals and if you are a professional get a proper education in computer science. Makes the forum a lot cleaner.

critter

  • New member
  • *
  • Posts: 14
Re: Help conversion string UTC to Datetime
« Reply #4 on: April 19, 2018, 02:13:05 pm »
the language is Spanish

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: Help conversion string UTC to Datetime
« Reply #5 on: April 19, 2018, 02:20:17 pm »
do a grep in your lazarus installation directory for  iso8601 there are at least 2 functions named Iso8601ToDate in mine. 1)fpindexer, 2)lazsvnpkg.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

critter

  • New member
  • *
  • Posts: 14
Re: Help conversion string UTC to Datetime
« Reply #6 on: April 19, 2018, 05:21:01 pm »
Thank you