PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Coherence between date and format
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Converts a date in character string format to a date in YYYYMMDD format.
Remark: The conversion performed by StringToDate consists in identifying, in the initial character string, the different components of the date to build the result string.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 16 and later
StringToDate proposes some new formats used to precisely configure the format of the days and the format of the months (presence of an uppercase character (or not) at the beginning of the day or at the beginning of the month.
New in version 16
StringToDate proposes some new formats used to precisely configure the format of the days and the format of the months (presence of an uppercase character (or not) at the beginning of the day or at the beginning of the month.
StringToDate proposes some new formats used to precisely configure the format of the days and the format of the months (presence of an uppercase character (or not) at the beginning of the day or at the beginning of the month.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 26 and later
Apple Watch This function is now available for Apple Watch applications.
New in version 26
Apple Watch This function is now available for Apple Watch applications.
Apple Watch This function is now available for Apple Watch applications.
Example
Res = StringToDate("25/12/2001")  // Res = "20011225"
Res = StringToDate("25-12-2001")  // Res = "20011225"
StringToDate("")                  // Returns ""
Res = StringToDate("12-25-2001", "MM-DD-YYYY")  // Res = "20011225"
Res = StringToDate("12-25-01", "MM-DD-YY")      // Res = "20011225"
Res = StringToDate("12-25-2001", "MM-DD-YY")    // Res = ""
Res = StringToDate("12-25-01", "MM-DD-YY")      // Res = "20011225"
Versions 16 and later
Res = StringToDate("Sun, 25 Nov 2012 12:11:55 +0100", maskDateEmail) // Res = "20121125121155"
Res = StringToDate("Sat, 25 Aug 2012 12:11:55 +0200", maskDateEmail) // Res = "20120825121155"
New in version 16
Res = StringToDate("Sun, 25 Nov 2012 12:11:55 +0100", maskDateEmail) // Res = "20121125121155"
Res = StringToDate("Sat, 25 Aug 2012 12:11:55 +0200", maskDateEmail) // Res = "20120825121155"
Res = StringToDate("Sun, 25 Nov 2012 12:11:55 +0100", maskDateEmail) // Res = "20121125121155"
Res = StringToDate("Sat, 25 Aug 2012 12:11:55 +0200", maskDateEmail) // Res = "20120825121155"
Versions 25 and later
Res = StringToDate("Sun, 24 Nov 2019 23:00:00 +0000", maskDateEmailUTC) // Res = "20191124230000000"
Res = StringToDate("2019-08-25T00:00:00.000+02:00", maskDateInternet) // Res = "20190825000000000"
Res = StringToDate("2019-08-24T22:00:00.000Z", maskDateInternetUTC) // Res = "20190824220000000"
New in version 25
Res = StringToDate("Sun, 24 Nov 2019 23:00:00 +0000", maskDateEmailUTC) // Res = "20191124230000000"
Res = StringToDate("2019-08-25T00:00:00.000+02:00", maskDateInternet) // Res = "20190825000000000"
Res = StringToDate("2019-08-24T22:00:00.000Z", maskDateInternetUTC) // Res = "20190824220000000"
Res = StringToDate("Sun, 24 Nov 2019 23:00:00 +0000", maskDateEmailUTC) // Res = "20191124230000000"
Res = StringToDate("2019-08-25T00:00:00.000+02:00", maskDateInternet) // Res = "20190825000000000"
Res = StringToDate("2019-08-24T22:00:00.000Z", maskDateInternetUTC) // Res = "20190824220000000"
Syntax
<Result> = StringToDate(<Date> [, <Format>])
<Result>: Character string or Date variable
  • Date in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
  • Empty string ("") if a problem occurs.
<Date>: Character string
Date in the format specified in <Format>.
<Format>: Optional character string or optional constant
Format of the date to convert:
  • in string format:
    In this string:
    • YYYY represents a 4-digit year.
    • YY represents a 2-digit year. The years will be included between 1951 and 2050.
    • M represents the month as a number without a leading zero.
    • MM represents a 2-digit month.
    • MMM represents a 3-letter month (e.g., Jan). The case used depends on the linguistic options of the project.
      WEBDEV - Browser code This notation is not case sensitive.
    • Versions 16 and later
      Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan).
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan).
      AndroidAndroid Widget JavaPHP This notation is not available.
      Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan).
      AndroidAndroid Widget JavaPHP This notation is not available.

      WEBDEV - Browser code This notation is not case sensitive.
    • Versions 16 and later
      mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
      AndroidAndroid Widget JavaPHP This notation is not available.
      mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
      AndroidAndroid Widget JavaPHP This notation is not available.

      WEBDEV - Browser code This notation is not case sensitive.
    • MMMM represents the month as a full name (e.g., January). The case used depends on the linguistic options of the project.
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
    • Versions 16 and later
      Mmmm represents the month as a full name with the first letter in uppercase (e.g., January)
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
      New in version 16
      Mmmm represents the month as a full name with the first letter in uppercase (e.g., January)
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
      Mmmm represents the month as a full name with the first letter in uppercase (e.g., January)
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
    • Versions 16 and later
      mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
      New in version 16
      mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
      mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
      AndroidAndroid Widget JavaPHP This notation is not available.
      WEBDEV - Browser code This notation is not case sensitive.
    • D represents the day without a leading zero,
    • DD represents a 2-digit day,
    • DDD represents a 3-letter day (e.g., Mon). The case used depends on the linguistic options of the project.
    • Versions 16 and later
      Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
      AndroidAndroid Widget JavaPHP This notation is not available.
      Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
      AndroidAndroid Widget JavaPHP This notation is not available.
    • Versions 16 and later
      ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
      AndroidAndroid Widget JavaPHP This notation is not available.
      ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
      AndroidAndroid Widget JavaPHP This notation is not available.
    • DDDD represents the day as a full name (e.g., Monday). The case used depends on the linguistic options of the project.
    • Versions 16 and later
      Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday)
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday)
      AndroidAndroid Widget JavaPHP This notation is not available.
      Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday)
      AndroidAndroid Widget JavaPHP This notation is not available.
    • Versions 16 and later
      dddd represents the day as a full name with the first letter in lowercase (e.g., monday)
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      dddd represents the day as a full name with the first letter in lowercase (e.g., monday)
      AndroidAndroid Widget JavaPHP This notation is not available.
      dddd represents the day as a full name with the first letter in lowercase (e.g., monday)
      AndroidAndroid Widget JavaPHP This notation is not available.
    • Versions 16 and later
      M represents the first letter of the day (e.g., M,T,W,T,F,S,S)
      AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      M represents the first letter of the day (e.g., M,T,W,T,F,S,S)
      AndroidAndroid Widget JavaPHP This notation is not available.
      M represents the first letter of the day (e.g., M,T,W,T,F,S,S)
      AndroidAndroid Widget JavaPHP This notation is not available.
  • via the following constants:
    Versions 16 and later
    maskDateEmail
    New in version 16
    maskDateEmail
    maskDateEmail
    The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, an RSS feed, ...
    The result is expressed in the local time zone.
    WEBDEV - Browser codeAndroidJavaPHP Not available.
    Versions 25 and later
    maskDateEmailUTC
    New in version 25
    maskDateEmailUTC
    maskDateEmailUTC
    The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, an RSS feed, ...
    The result is expressed in universal time (UTC).
    WEBDEV - Browser codeAndroidJavaPHP Not available.
    Versions 25 and later
    maskDateInternet
    New in version 25
    maskDateInternet
    maskDateInternet
    The format used corresponds to the RFC-3339 standard used for international communications.
    The result is expressed in the local time zone.
    Versions 25 and later
    maskDateInternetUTC
    New in version 25
    maskDateInternetUTC
    maskDateInternetUTC
    The format used corresponds to the RFC-3339 standard used for international communications.
    The result is expressed in universal time (UTC).
    WEBDEV - Browser code Not available.
    maskDateSystemThe format used corresponds to the format defined in the project description for the current language:
    1. On the "Project" pane, in the "Project" group, click "Description".
    2. Select the "Languages" tab then the "Date" tab.
    3. The format used corresponds to:
      • the settings of the operating system,
      • the specified parameters (with the defined days and months).
If this parameter is not specified, the format used by default is DD/MM/YYYY (DD + a specific character + MM + a specific character + YYYY).
Remarks

Coherence between date and format

You must check whether the <Date> and the specified <Format> are coherent. Therefore:
  • If <Date> = "This monument was inaugurated on February 10, 1995", the following format must be used:
    <Format> = "This monument was inaugurated on MMMM DD, YYYY".
  • If <Date> = "11/03/1970", the following format must be used:
    <Format> = "MM/DD/YYYY".
Related Examples:
The EXIF functions Unit examples (WINDEV): The EXIF functions
[ + ] Using the ImageXXX functions.
These functions are used to access the EXIF information of an image.
The EXIF information is included in the JPEG or TIFF images.
It can be for example the snapshot date, the orientation of the device when taking the photo, the make and model of the camera, a miniature of the image...
Business / UI classification: Neutral code
Component: wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo StringtoDate
Exemplo StringtoDate

//Transforma Texto em Data // Transforms Text Data // Transforme données texte
EDT_Date=StringToDate("12-25-2001","MM-DD-YYYY")
//Frances
EDT_Date=ChaîneVersDate("12-25-2001","MM-DD-YYYY")

//Blog com video e exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/07/curso-windev-datas-013-stringtodate.html
https://www.youtube.com/watch?v=OQTm5a5dWbI


De matos AMARILDO
26 Jul. 2016