ParseDate()

Syntax

Date = ParseDate(Mask$, String$)
Description
Transforms a string date into a regular date value which then can be used by other date functions. If the date is incorrect, then -1 is returned. This function is very useful to retrieve dates already saved (in a log file for example) and do some operations on them.
The Mask$ is a string which specifies how the date is formatted. The Mask$ accepts several reserved tokens:
  %yyyy: Will be replaced by the year value, on 4 digits.
  %yy: Will be replaced by the year value, on 2 digits.
  %mm: Will be replaced by the month value, on 2 digits.
  %dd: Will be replaced by the day value, on 2 digits.
  %hh: Will be replaced by the hour value, on 2 digits.
  %ii: Will be replaced by the minute value, on 2 digits.
  %ss: Will be replaced by the second value, on 2 digits.

Example:


  Debug ParseDate("%yy/%mm/%dd", "10/01/07")     ; Returns the date value of "10/01/07"

  Debug ParseDate("%mm/%dd/%yyyy", "01/07/2010") ; Returns the date value of "01/07/2010"


Note: The 'String$' to be converted into a date value must contain at least one separator between each part of the date (e.g. a slash character).

Supported OS

All

<- Month() - Date Index - Second() ->