Recent

Author Topic: [SOLVED] Correct Date Format  (Read 797 times)

borland convert

  • Newbie
  • Posts: 2
[SOLVED] Correct Date Format
« on: April 30, 2021, 08:06:40 pm »
"MM-DD-YYYY" was accepted as a correct date format in older versions of freepascal/lazarus. However, with the latest 3.2.0/2.0.12 version, i get the error message

"MM-DD-YYYY" is not a correct date format.

I can't find the currently accepted date format on the net or in freepascal documentation.

Is this a problem with freepascal or lazarus? What are accepted formats now?

Thx.
« Last Edit: May 01, 2021, 08:05:27 am by borland convert »

lucamar

  • Hero Member
  • *****
  • Posts: 4014
Re: Correct Date Format
« Reply #1 on: April 30, 2021, 10:10:05 pm »
Formats for what? FormatDateTime()? DateToStr()? TFormatSettings? ????

What is it you're trying to do and where and how it doesn't work?
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2702
Re: Correct Date Format
« Reply #2 on: April 30, 2021, 10:11:01 pm »
"MM-DD-YYYY" was accepted as a correct date format in older versions of freepascal/lazarus. However, with the latest 3.2.0/2.0.12 version, i get the error message

"MM-DD-YYYY" is not a correct date format.

I can't find the currently accepted date format on the net or in freepascal documentation.

Is this a problem with freepascal or lazarus? What are accepted formats now?

Might depend on your locale and OS (neither of which you're telling us) but in the interim I'd direct your attention to https://xkcd.com/1179/

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

wp

  • Hero Member
  • *****
  • Posts: 8366
Re: Correct Date Format
« Reply #3 on: April 30, 2021, 10:58:59 pm »
"MM-DD-YYYY" is not a correct date format.
Nobody knows what you are doing. Show the code which causes this error.

Structurally, the format string is correct. Or are applying it with double quotes? Then it is wrong. Strings are single-quoted in Pascal.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018