What format should the input of StrToDateTime() function be?

Is there any specific format that is used by STrToDateTime() function, or does it detect it automatically somehow?

Should the string be in DD/MM/YYYY or MM/DD/YYYY or any other format?

The function tries to figure out the date in multiple formats automatically, but some string can be interpreted in a number of ways (like 01/02/03) and may be misinterpreted.

For best results use:

  1. current Windows regional date format (depends on Control Panel settings)
  2. International ISO format YYYY-MM-DD (or YYYY-MM-DD HH:MM:SS when time is included)
1 Like

Thanks for the reply, it helped as I was using MM-DD-YYYY and my system setting was DD-MM-YYYY so it was misinterpreting some of the dates.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.