PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Validity of the date
  • Date format
  • Special case: is not specified
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 to a string in the specified format
  • Versions 18 and later
    WEBDEV - Server codeWEBDEV - Browser codePHP a date time to a string in the specified format
    New in version 18
    WEBDEV - Server codeWEBDEV - Browser codePHP a date time to a string in the specified format
    WEBDEV - Server codeWEBDEV - Browser codePHP a date time to a string in the specified format
    Versions 26 and later
    You can also use DateTimeToString to convert a date time to a string with a specific format.
    New in version 26
    You can also use DateTimeToString to convert a date time to a string with a specific format.
    You can also use DateTimeToString to convert a date time to a string with a specific format.
Tip: If the formatted date contains the "/" characters, it must not be displayed it in a Date edit control.
Example
Res = DateToString("20191225") // Res = "25/12/2019"
 
Res = DateToString(IntegerToDate(73773)) // Res = "25/12/2001"
 
DateToString("") // Returns ""
 
Res = DateToString("20191225", "MM-DD-YYYY") // Res = "12-25-2019"
 
Res = DateToString("20791225", "Day # DD of the month # MM, YYYY")
 
Res = DateToString(DateSys(), maskDateSystem)
// Res uses the format defined in the project
Versions 16 and later
// The case used for the days and for the months depends on the linguistic options of the project
Res = DateToString("20031202", "DDD DD MMM YYYY")
// Res = "tue. 02 dec. 2003" or "Tue. 02 Dec. 2003"
 
Res = DateToString("20031202", "DDDD DD MMMM YYYY")
// Res = "tuesday 02 december 2003" or "Tuesday 02 December 2003"
 
// You can force the use of uppercase letters for days and months
Res = DateToString("20031202", "Ddd DD Mmm YYYY") // Res = "Tue. 02 Dec. 2003"
Res = DateToString("20031202", "Dddd DD MMMM YYYY") // Res = "Tuesday 02 December 2003"
New in version 16
// The case used for the days and for the months depends on the linguistic options of the project
Res = DateToString("20031202", "DDD DD MMM YYYY")
// Res = "tue. 02 dec. 2003" or "Tue. 02 Dec. 2003"
 
Res = DateToString("20031202", "DDDD DD MMMM YYYY")
// Res = "tuesday 02 december 2003" or "Tuesday 02 December 2003"
 
// You can force the use of uppercase letters for days and months
Res = DateToString("20031202", "Ddd DD Mmm YYYY") // Res = "Tue. 02 Dec. 2003"
Res = DateToString("20031202", "Dddd DD MMMM YYYY") // Res = "Tuesday 02 December 2003"
// The case used for the days and for the months depends on the linguistic options of the project
Res = DateToString("20031202", "DDD DD MMM YYYY")
// Res = "tue. 02 dec. 2003" or "Tue. 02 Dec. 2003"
 
Res = DateToString("20031202", "DDDD DD MMMM YYYY")
// Res = "tuesday 02 december 2003" or "Tuesday 02 December 2003"
 
// You can force the use of uppercase letters for days and months
Res = DateToString("20031202", "Ddd DD Mmm YYYY") // Res = "Tue. 02 Dec. 2003"
Res = DateToString("20031202", "Dddd DD MMMM YYYY") // Res = "Tuesday 02 December 2003"
Versions 16 and later
Res = DateToString("20191125", maskDateEmail)
// Returns "Mon, 25 Nov 2019 00:00:00 +0100"
 
Res = DateToString("20190825", maskDateEmail)  
// Returns "Sun, 25 Aug 2019 00:00:00 +0200"
New in version 16
Res = DateToString("20191125", maskDateEmail)
// Returns "Mon, 25 Nov 2019 00:00:00 +0100"
 
Res = DateToString("20190825", maskDateEmail)  
// Returns "Sun, 25 Aug 2019 00:00:00 +0200"
Res = DateToString("20191125", maskDateEmail)
// Returns "Mon, 25 Nov 2019 00:00:00 +0100"
 
Res = DateToString("20190825", maskDateEmail)  
// Returns "Sun, 25 Aug 2019 00:00:00 +0200"
Versions 25 and later
Res = DateToString("20191125", maskDateEmailUTC)
// Returns "Sun, 24 Nov 2019 23:00:00 +0000"
 
Res = DateToString("20190825", maskDateInternet)  
// Returns "2019-08-25T00:00:00.000+02:00"
 
Res = DateToString("20190825", maskDateInternetUTC)  
// Returns "2019-08-24T22:00:00.000Z"
New in version 25
Res = DateToString("20191125", maskDateEmailUTC)
// Returns "Sun, 24 Nov 2019 23:00:00 +0000"
 
Res = DateToString("20190825", maskDateInternet)  
// Returns "2019-08-25T00:00:00.000+02:00"
 
Res = DateToString("20190825", maskDateInternetUTC)  
// Returns "2019-08-24T22:00:00.000Z"
Res = DateToString("20191125", maskDateEmailUTC)
// Returns "Sun, 24 Nov 2019 23:00:00 +0000"
 
Res = DateToString("20190825", maskDateInternet)  
// Returns "2019-08-25T00:00:00.000+02:00"
 
Res = DateToString("20190825", maskDateInternetUTC)  
// Returns "2019-08-24T22:00:00.000Z"
Versions 18 and later
// As of 01/22/2019
Res = DateToString("20190101", maskDateRelativeDuration)  
// Returns: 3 weeks ago
 
Res = DateToString("20191125", maskDateRelativeDuration)  
// Returns: in 10 months
 
Res = DateToString("20190118", maskDateRelativeDuration)
// Returns: last week
New in version 18
// As of 01/22/2019
Res = DateToString("20190101", maskDateRelativeDuration)  
// Returns: 3 weeks ago
 
Res = DateToString("20191125", maskDateRelativeDuration)  
// Returns: in 10 months
 
Res = DateToString("20190118", maskDateRelativeDuration)
// Returns: last week
// As of 01/22/2019
Res = DateToString("20190101", maskDateRelativeDuration)  
// Returns: 3 weeks ago
 
Res = DateToString("20191125", maskDateRelativeDuration)  
// Returns: in 10 months
 
Res = DateToString("20190118", maskDateRelativeDuration)
// Returns: last week
Syntax

Converting a date to string Hide the details

<Result> = DateToString(<Date> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date>: Character string or Date variable
Date to convert. If this date corresponds to a string, it must be in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
<Format>: Optional character string
Format of the converted date. This parameter can contain a word, a sentence, ... The characters that represent the different elements of the date (YYYY, YY, MM or DD) will be automatically replaced by the value in the <Date> parameter. In this string:
  • YYYY represents a 4-digit year,
  • YY represents a 2-digit year.
  • M represents the month 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.
  • Versions 16 and later
    Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
    PHP This notation is not available.
    New in version 16
    Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
    PHP This notation is not available.
    Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
    PHP This notation is not available.
  • Versions 16 and later
    mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
    PHP This notation is not available.
    New in version 16
    mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
    PHP This notation is not available.
    mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
    PHP This notation is not available.
  • MMMM represents the month as a full name (e.g., January). The case used depends on the linguistic options of the project.
    PHP This notation is not available.
  • Versions 16 and later
    mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
    PHP This notation is not available.
    New in version 16
    mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
    PHP This notation is not available.
    mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
    PHP This notation is not available.
  • 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)
    PHP This notation is not available.
    New in version 16
    Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
    PHP This notation is not available.
    Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
    PHP This notation is not available.
  • Versions 16 and later
    ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
    PHP This notation is not available.
    New in version 16
    ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
    PHP This notation is not available.
    ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
    PHP 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).
    PHP 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).
    PHP This notation is not available.
    Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday).
    PHP 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).
    PHP 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).
    PHP This notation is not available.
    dddd represents the day as a full name with the first letter in lowercase (e.g., monday).
    PHP 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).
    If this parameter corresponds to the constant:
    Versions 18 and later
    maskDateRelativeDuration
    New in version 18
    maskDateRelativeDuration
    maskDateRelativeDuration
    This format is used to express the time elapsed (or that will elapse) between the current date and the specified date. This format is expressed in natural language. The different formulations used can be configured in the project description for the current language:
    1. On the "Project" pane, in the "Project" group, click "Description".
    2. In the "Languages" tab:
      • select the language to configure.
      • select the "Date" tab.
    3. Click the "Dates and Times in natural language" button.
    4. Define (if necessary) the custom captions to use. These captions will be used:
      • for the result of DateToString.
      • for the controls that use the "Relative duration" display mask.
    WEBDEV - Browser code Not available.
    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 codePHP 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 codePHP 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 DD/MM/YYYY format is used by default.
    New in version 16
    M represents the first letter of the day (e.g., M,T,W,T,F,S,S).
    If this parameter corresponds to the constant:
    Versions 18 and later
    maskDateRelativeDuration
    New in version 18
    maskDateRelativeDuration
    maskDateRelativeDuration
    This format is used to express the time elapsed (or that will elapse) between the current date and the specified date. This format is expressed in natural language. The different formulations used can be configured in the project description for the current language:
    1. On the "Project" pane, in the "Project" group, click "Description".
    2. In the "Languages" tab:
      • select the language to configure.
      • select the "Date" tab.
    3. Click the "Dates and Times in natural language" button.
    4. Define (if necessary) the custom captions to use. These captions will be used:
      • for the result of DateToString.
      • for the controls that use the "Relative duration" display mask.
    WEBDEV - Browser code Not available.
    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 codePHP 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 codePHP 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 DD/MM/YYYY format is used by default.
    M represents the first letter of the day (e.g., M,T,W,T,F,S,S).
    If this parameter corresponds to the constant:
    Versions 18 and later
    maskDateRelativeDuration
    New in version 18
    maskDateRelativeDuration
    maskDateRelativeDuration
    This format is used to express the time elapsed (or that will elapse) between the current date and the specified date. This format is expressed in natural language. The different formulations used can be configured in the project description for the current language:
    1. On the "Project" pane, in the "Project" group, click "Description".
    2. In the "Languages" tab:
      • select the language to configure.
      • select the "Date" tab.
    3. Click the "Dates and Times in natural language" button.
    4. Define (if necessary) the custom captions to use. These captions will be used:
      • for the result of DateToString.
      • for the controls that use the "Relative duration" display mask.
    WEBDEV - Browser code Not available.
    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 codePHP 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 codePHP 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 DD/MM/YYYY format is used by default.
Versions 18 and later
WEBDEV - Server codeWEBDEV - Browser codePHP

Converting a datetime to string Hide the details

<Result> = DateToString(<Date and time> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date and time>: Character string or DateTime variable
Date and time to convert. This parameter can correspond to:
  • a character string containing the date and time in YYYYMMJJHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second).
  • a DateTime variable.
<Format>: Optional character string
Format of the converted date and time. This parameter can contain a word, a sentence, ... The characters that represent the different elements of the date and time will be automatically replaced by the value in the <Date and time> parameter. In this string:
  • YYYY represents a 4-digit year,
  • YY represents a 2-digit year,
  • M represents the month 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.
  • Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
    PHP This notation is not available.
  • mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
    PHP This notation is not available.
  • MMMM represents the month as a full name (e.g., January). The case used depends on the linguistic options of the project.
  • Mmmm represents the month as a full name with the first letter in uppercase (e.g., January)
    PHP This notation is not available.
  • mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
    PHP This notation is not available.
  • 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.
  • Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
    PHP This notation is not available.
  • ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
    PHP 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.
  • Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday)
    PHP This notation is not available.
  • dddd represents the day as a full name with the first letter in lowercase (e.g., monday)
    PHP This notation is not available.
  • M represents the first letter of the day (e.g., M,T,W,T,F,S,S)
  • HH represents the number of hours,
  • mm represents the number of minutes,
  • SS represents the number of seconds,
  • CC represents the number of hundredths of a second,
  • AP represents "AM" or "PM" (if "AP" is used, the time is displayed in 12-hour format).
If this parameter corresponds to the constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the time elapsed (or that will elapse) between the current date and the specified date. This format is expressed in natural language. The different formulations used can be configured in the project description for the current language:
  1. On the "Project" pane, in the "Project" group, click "Description".
  2. In the "Languages" tab:
    • select the language to configure.
    • select the "Date" tab.
  3. Click the "Dates and Times in natural language" button.
  4. Define (if necessary) the custom captions to use. These captions will be used:
    • for the result of DateToString.
    • for the controls that use the "Relative duration" display mask.
WEBDEV - Browser code Not available.
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 codePHP 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 codePHP 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 DD/MM/YYYY HH:mm:SS:CC format is used by default.
New in version 18
WEBDEV - Server codeWEBDEV - Browser codePHP

Converting a datetime to string Hide the details

<Result> = DateToString(<Date and time> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date and time>: Character string or DateTime variable
Date and time to convert. This parameter can correspond to:
  • a character string containing the date and time in YYYYMMJJHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second).
  • a DateTime variable.
<Format>: Optional character string
Format of the converted date and time. This parameter can contain a word, a sentence, ... The characters that represent the different elements of the date and time will be automatically replaced by the value in the <Date and time> parameter. In this string:
  • YYYY represents a 4-digit year,
  • YY represents a 2-digit year,
  • M represents the month 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.
  • Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
    PHP This notation is not available.
  • mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
    PHP This notation is not available.
  • MMMM represents the month as a full name (e.g., January). The case used depends on the linguistic options of the project.
  • Mmmm represents the month as a full name with the first letter in uppercase (e.g., January)
    PHP This notation is not available.
  • mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
    PHP This notation is not available.
  • 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.
  • Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
    PHP This notation is not available.
  • ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
    PHP 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.
  • Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday)
    PHP This notation is not available.
  • dddd represents the day as a full name with the first letter in lowercase (e.g., monday)
    PHP This notation is not available.
  • M represents the first letter of the day (e.g., M,T,W,T,F,S,S)
  • HH represents the number of hours,
  • mm represents the number of minutes,
  • SS represents the number of seconds,
  • CC represents the number of hundredths of a second,
  • AP represents "AM" or "PM" (if "AP" is used, the time is displayed in 12-hour format).
If this parameter corresponds to the constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the time elapsed (or that will elapse) between the current date and the specified date. This format is expressed in natural language. The different formulations used can be configured in the project description for the current language:
  1. On the "Project" pane, in the "Project" group, click "Description".
  2. In the "Languages" tab:
    • select the language to configure.
    • select the "Date" tab.
  3. Click the "Dates and Times in natural language" button.
  4. Define (if necessary) the custom captions to use. These captions will be used:
    • for the result of DateToString.
    • for the controls that use the "Relative duration" display mask.
WEBDEV - Browser code Not available.
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 codePHP 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 codePHP 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 DD/MM/YYYY HH:mm:SS:CC format is used by default.
WEBDEV - Server codeWEBDEV - Browser codePHP

Converting a datetime to string Hide the details

<Result> = DateToString(<Date and time> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date and time>: Character string or DateTime variable
Date and time to convert. This parameter can correspond to:
  • a character string containing the date and time in YYYYMMJJHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second).
  • a DateTime variable.
<Format>: Optional character string
Format of the converted date and time. This parameter can contain a word, a sentence, ... The characters that represent the different elements of the date and time will be automatically replaced by the value in the <Date and time> parameter. In this string:
  • YYYY represents a 4-digit year,
  • YY represents a 2-digit year,
  • M represents the month 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.
  • Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
    PHP This notation is not available.
  • mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
    PHP This notation is not available.
  • MMMM represents the month as a full name (e.g., January). The case used depends on the linguistic options of the project.
  • Mmmm represents the month as a full name with the first letter in uppercase (e.g., January)
    PHP This notation is not available.
  • mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
    PHP This notation is not available.
  • 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.
  • Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
    PHP This notation is not available.
  • ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
    PHP 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.
  • Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday)
    PHP This notation is not available.
  • dddd represents the day as a full name with the first letter in lowercase (e.g., monday)
    PHP This notation is not available.
  • M represents the first letter of the day (e.g., M,T,W,T,F,S,S)
  • HH represents the number of hours,
  • mm represents the number of minutes,
  • SS represents the number of seconds,
  • CC represents the number of hundredths of a second,
  • AP represents "AM" or "PM" (if "AP" is used, the time is displayed in 12-hour format).
If this parameter corresponds to the constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the time elapsed (or that will elapse) between the current date and the specified date. This format is expressed in natural language. The different formulations used can be configured in the project description for the current language:
  1. On the "Project" pane, in the "Project" group, click "Description".
  2. In the "Languages" tab:
    • select the language to configure.
    • select the "Date" tab.
  3. Click the "Dates and Times in natural language" button.
  4. Define (if necessary) the custom captions to use. These captions will be used:
    • for the result of DateToString.
    • for the controls that use the "Relative duration" display mask.
WEBDEV - Browser code Not available.
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 codePHP 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 codePHP 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 DD/MM/YYYY HH:mm:SS:CC format is used by default.
Remarks

Validity of the date

The validity of the date passed as parameter is checked. A message is displayed if the date is invalid. You can check the validity of a date using DateValid. The date storage format allows you to store dates from 01/01/0001 to 12/31/9999.
The calculations performed on dates by the WLanguage functions or by the WLanguage properties are accurate from January 1st 1583.

Date format

DateToString is used to format a date returned by IntegerToDate or DateSys. The result can be assigned to a text control, for example.
To get the date in another format, use Right, Left, Middle, etc.

Special case: <Format> is not specified

The language options specified for dates in the project description are used if no specific format is defined.
To display the linguistic options of the project:
  1. Open the project description: on the "Project" pane, in the "Project" group, click "Description".
  2. Select the "Language" tab.
For example:
  • if the project uses the linguistic options of Windows for the dates, the days of the week and the months will start with an Uppercase character on a computer running Windows in English.
  • if the project uses specific parameters for the dates for one or more languages (custom name of the day or month, etc.), these parameters will be taken into account for the specified language.
Related Examples:
Management of dates Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
Business / UI classification : Neutral code
Component : wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video DateToString
https://youtu.be/MvxW2m9T-iE

https://windevdesenvolvimento.blogspot.com/2019/04/windev-mobile-dicas-2091-windev-data-27.html

EDT_DATA_FORMATADO=DateToString(EDT_Date,"DD/MM/AAAA")

amarildo
30 Apr. 2019
COLOCAR BARRA NA DATA STRING
//EDT_DATA_STRING=EDT_DATA
// VAI COLOCAR NA STRING A DATA SOMENTE COM OS NUMEROS


EDT_DATA_STRING=DateToString(EDT_data,"DD/MM/YYYY")

// VAI COLOCAR A DATA , JA COM BARRA /

https://youtu.be/vmXEK383sL4
De matos
29 Jun. 2018
exemplo data
PROCEDURE ncm_ler_material()
HReadSeekFirst(ncm,ncm_classificacao,EDT_Ncm_classificacao)
IF HFound(ncm) THEN
STC_ipi_nome=DateToString(ncm.importado_vigencia_inicio,"DD-MM-YYYY")+" A "+ ...
DateToString(ncm.importado_vigencia_final,"DD-MM-YYYY")+" "+ ...
ncm.descricao_ncm
EDT_Percentual_ipi=ncm.aliquota_ipi
ELSE
EDT_Percentual_ipi=""
STC_ipi_nome=""
END

// blog com vídeo e exemplo

http://windevdesenvolvimento.blogspot.com.br/2018/01/aula-1330-windev-data-019-datetostring.html

https://www.youtube.com/watch?v=DDbB45XvaKI
De matos
04 Jan. 2018