PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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
Formats:
  • the specified date to the specified format.
  • Versions 18 and later
    WINDEVWEBDEV - Server codeWEBDEV - Browser codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHP the specified date time to the specified format.
    New in version 18
    WINDEVWEBDEV - Server codeWEBDEV - Browser codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHP the specified date time to the specified format.
    WINDEVWEBDEV - Server codeWEBDEV - Browser codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHP the specified date time to the specified format.
Versions 16 and later
DateToString proposes 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).
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
DateToString proposes 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).
Universal Windows 10 App This function is now available for the Windows Phone applications.
DateToString proposes 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).
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps 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.
Tip: If the formatted date contains the "/" characters, it must not be displayed it in a Date edit control.
Example
Res = DateToString("20011225")  
// Res = "25/12/2001"

Res = DateToString(IntegerToDate(73773))
// Res = "25/12/2001"

DateToString("")      
// Returns ""

Res = DateToString("20011225", "MM-DD-YYYY")
// Res = "12-25-2001"

Res = DateToString("20011225", "The number of day DD of month MM of year YYYY")

Res = DateToString(DateSys(), maskSystemDate)
// Res is using 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"

// The case used for the days and for the months is forced with an uppercase character
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"

// The case used for the days and for the months is forced with an uppercase character
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"

// The case used for the days and for the months is forced with an uppercase character
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("20121125", maskEmailDate)
// Returns "Sun, 25 Nov 2012 00:00:00 +0100"

Res = DateToString("20120825", maskEmailDate)  
// Returns "Sat, 25 Aug 2012 00:00:00 +0200"
New in version 16
Res = DateToString("20121125", maskEmailDate)
// Returns "Sun, 25 Nov 2012 00:00:00 +0100"

Res = DateToString("20120825", maskEmailDate)  
// Returns "Sat, 25 Aug 2012 00:00:00 +0200"
Res = DateToString("20121125", maskEmailDate)
// Returns "Sun, 25 Nov 2012 00:00:00 +0100"

Res = DateToString("20120825", maskEmailDate)  
// Returns "Sat, 25 Aug 2012 00:00:00 +0200"
Versions 18 and later
// The date is 01/22/2013
Res = DateToString("20130101", maskDateRelativeDuration)
// Returns: 3 weeks ago

Res = DateToString("20132511", maskDateRelativeDuration)  
// Returns: in 10 months

Res = DateToString("20131801", maskDateRelativeDuration)
// Returns: last week
New in version 18
// The date is 01/22/2013
Res = DateToString("20130101", maskDateRelativeDuration)
// Returns: 3 weeks ago

Res = DateToString("20132511", maskDateRelativeDuration)  
// Returns: in 10 months

Res = DateToString("20131801", maskDateRelativeDuration)
// Returns: last week
// The date is 01/22/2013
Res = DateToString("20130101", maskDateRelativeDuration)
// Returns: 3 weeks ago

Res = DateToString("20132511", maskDateRelativeDuration)  
// Returns: in 10 months

Res = DateToString("20131801", maskDateRelativeDuration)
// Returns: last week
Syntax

Converting a date into string Hide the details

<Result> = DateToString(<Date> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date>: Character string, Date variable
Character string containing the date 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 specific characters representing the different elements of the date (YYYY, YY, MM or DD) will be automatically replaced by their value identified in the <Date> string. In this string, the characters:
  • YYYY represent the year on 4 digits,
  • YY represent the year on 2 digits.
  • M represents the month (no zero is displayed in front of the month number),
  • MM represent the month on 2 digits,
  • MMM represent the month in letters on 3 characters (for example: jan). The case used depends on the linguistic options of project.
    WEBDEV - Browser code This notation is not available in browser code.
  • Versions 16 and later
    Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • Versions 16 and later
    mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • MMMM represent the full month in letters (for example: January). The case used depends on the linguistic options of project.
    WEBDEV - Browser code This notation is not available in browser code.
    • Versions 16 and later
      Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
      WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
      New in version 16
      Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
      WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
      Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
      WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • Versions 16 and later
    mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • D represents the day (no zero is displayed in front of the day number),
  • DD represent the day on 2 digits,
  • DDD represent the day in letters on 3 characters (for example: Mon). The case used depends on the linguistic options of project.
    WEBDEV - Browser code This notation is not available in browser code.
  • Versions 16 and later
    Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • Versions 16 and later
    ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • DDDD represent the full day in letters (for example: monday). The case used depends on the linguistic options of project.
    WEBDEV - Browser code This notation is not available in browser code.
  • Versions 16 and later
    Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • Versions 16 and later
    dddd represent the full day in letters with the first letter forced in lowercase (for example: monday).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    dddd represent the full day in letters with the first letter forced in lowercase (for example: monday).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    dddd represent the full day in letters with the first letter forced in lowercase (for example: monday).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    PHP This notation is not available.
  • Versions 16 and later
    M represents the first letter of the day (for example: M,T,W,T,F,S,S).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    New in version 16
    M represents the first letter of the day (for example: M,T,W,T,F,S,S).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
    M represents the first letter of the day (for example: M,T,W,T,F,S,S).
    WEBDEV - Browser codeAndroidAndroid Widget JavaPHP This notation is not available. AndroidAndroid Widget JavaPHP This notation is not available.
If this parameter corresponds to the following constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the duration passed (or the future duration) between the today's date and the specified date. This format is expressed in natural en 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.
Versions 16 and later
maskEmailDate
New in version 16
maskEmailDate
maskEmailDate
The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, a RSS stream, ...
maskSystemDateThe format used corresponds to the format defined in the project description for the current language ("Project .. Project description", "Languages" tab).
WEBDEV - Browser code This constant is not available.
The 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 parameters 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
WINDEVWEBDEV - Server codeWEBDEV - Browser codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHP

Converting a datetime into string Hide the details

<Result> = DateToString(<Date and Time> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date and Time>: Character string, DateTime variable
Character string containing the date and the time in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to the hours, MM to the minutes, SS to the seconds and CC to the hundredths of a second).
<Format>: Optional character string
Format of the converted date and time. This parameter can contain a word, a sentence, ... The specific characters representing the different elements of the date and time will be automatically replaced by their value identified in the <Date and Time> string. In this string, the characters:
  • YYYY represent the year on 4 digits,
  • YY represent the date on 2 digits,
  • M represents the month (no zero is displayed in front of the month number),
  • MM represent the month on 2 digits,
  • MMM represent the month in letters on 3 characters (for example: jan). The case used depends on the linguistic options of project.
  • Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    PHP This notation is not available.
  • mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    PHP This notation is not available.
  • MMMM represent the full month in letters (for example: January). The case used depends on the linguistic options of project.
  • Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
    PHP This notation is not available.
  • mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    PHP This notation is not available.
  • D represents the day (no zero is displayed in front of the day number),
  • DD represent the day on 2 digits,
  • DDD represent the day in letters on 3 characters (for example: Mon). The case used depends on the linguistic options of project.
  • Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    PHP This notation is not available.
  • ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    PHP This notation is not available.
  • DDDD represent the full day in letters (for example: monday). The case used depends on the linguistic options of project.
  • Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday)
    PHP This notation is not available.
  • dddd represent the full day in letters with the first letter forced in lowercase (for example: monday)
    PHP This notation is not available.
  • M represents the first letter of the day (for example: M,T,W,T,F,S,S)
    PHP This notation is not available.
  • HH represent the number of hours,
  • mm represent the number of minutes,
  • SS represent the number of seconds,
  • CC represent the number of hundredths of a second,
  • AP represent "AM" or "PM" (if "AM" is found in the format, the time is displayed over 12 hours).
If this parameter corresponds to the following constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the duration passed (or the future duration) between the today's date and the specified date. This format is expressed in natural en 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.
Versions 16 and later
maskEmailDate
New in version 16
maskEmailDate
maskEmailDate
The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, a RSS stream, ...
maskSystemDateThe format used corresponds to the format defined in the project description for the current language ("Project .. Project description", "Languages" tab).
WEBDEV - Browser code This constant is not available.
The 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 parameters 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
WINDEVWEBDEV - Server codeWEBDEV - Browser codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHP

Converting a datetime into string Hide the details

<Result> = DateToString(<Date and Time> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date and Time>: Character string, DateTime variable
Character string containing the date and the time in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to the hours, MM to the minutes, SS to the seconds and CC to the hundredths of a second).
<Format>: Optional character string
Format of the converted date and time. This parameter can contain a word, a sentence, ... The specific characters representing the different elements of the date and time will be automatically replaced by their value identified in the <Date and Time> string. In this string, the characters:
  • YYYY represent the year on 4 digits,
  • YY represent the date on 2 digits,
  • M represents the month (no zero is displayed in front of the month number),
  • MM represent the month on 2 digits,
  • MMM represent the month in letters on 3 characters (for example: jan). The case used depends on the linguistic options of project.
  • Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    PHP This notation is not available.
  • mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    PHP This notation is not available.
  • MMMM represent the full month in letters (for example: January). The case used depends on the linguistic options of project.
  • Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
    PHP This notation is not available.
  • mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    PHP This notation is not available.
  • D represents the day (no zero is displayed in front of the day number),
  • DD represent the day on 2 digits,
  • DDD represent the day in letters on 3 characters (for example: Mon). The case used depends on the linguistic options of project.
  • Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    PHP This notation is not available.
  • ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    PHP This notation is not available.
  • DDDD represent the full day in letters (for example: monday). The case used depends on the linguistic options of project.
  • Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday)
    PHP This notation is not available.
  • dddd represent the full day in letters with the first letter forced in lowercase (for example: monday)
    PHP This notation is not available.
  • M represents the first letter of the day (for example: M,T,W,T,F,S,S)
    PHP This notation is not available.
  • HH represent the number of hours,
  • mm represent the number of minutes,
  • SS represent the number of seconds,
  • CC represent the number of hundredths of a second,
  • AP represent "AM" or "PM" (if "AM" is found in the format, the time is displayed over 12 hours).
If this parameter corresponds to the following constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the duration passed (or the future duration) between the today's date and the specified date. This format is expressed in natural en 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.
Versions 16 and later
maskEmailDate
New in version 16
maskEmailDate
maskEmailDate
The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, a RSS stream, ...
maskSystemDateThe format used corresponds to the format defined in the project description for the current language ("Project .. Project description", "Languages" tab).
WEBDEV - Browser code This constant is not available.
The 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 parameters 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.
WINDEVWEBDEV - Server codeWEBDEV - Browser codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppPHP

Converting a datetime into string Hide the details

<Result> = DateToString(<Date and Time> [, <Format>])
<Result>: Character string
Character string in the specified format.
<Date and Time>: Character string, DateTime variable
Character string containing the date and the time in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to the hours, MM to the minutes, SS to the seconds and CC to the hundredths of a second).
<Format>: Optional character string
Format of the converted date and time. This parameter can contain a word, a sentence, ... The specific characters representing the different elements of the date and time will be automatically replaced by their value identified in the <Date and Time> string. In this string, the characters:
  • YYYY represent the year on 4 digits,
  • YY represent the date on 2 digits,
  • M represents the month (no zero is displayed in front of the month number),
  • MM represent the month on 2 digits,
  • MMM represent the month in letters on 3 characters (for example: jan). The case used depends on the linguistic options of project.
  • Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    PHP This notation is not available.
  • mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    PHP This notation is not available.
  • MMMM represent the full month in letters (for example: January). The case used depends on the linguistic options of project.
  • Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
    PHP This notation is not available.
  • mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    PHP This notation is not available.
  • D represents the day (no zero is displayed in front of the day number),
  • DD represent the day on 2 digits,
  • DDD represent the day in letters on 3 characters (for example: Mon). The case used depends on the linguistic options of project.
  • Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    PHP This notation is not available.
  • ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    PHP This notation is not available.
  • DDDD represent the full day in letters (for example: monday). The case used depends on the linguistic options of project.
  • Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday)
    PHP This notation is not available.
  • dddd represent the full day in letters with the first letter forced in lowercase (for example: monday)
    PHP This notation is not available.
  • M represents the first letter of the day (for example: M,T,W,T,F,S,S)
    PHP This notation is not available.
  • HH represent the number of hours,
  • mm represent the number of minutes,
  • SS represent the number of seconds,
  • CC represent the number of hundredths of a second,
  • AP represent "AM" or "PM" (if "AM" is found in the format, the time is displayed over 12 hours).
If this parameter corresponds to the following constant:
Versions 18 and later
maskDateRelativeDuration
New in version 18
maskDateRelativeDuration
maskDateRelativeDuration
This format is used to express the duration passed (or the future duration) between the today's date and the specified date. This format is expressed in natural en 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.
Versions 16 and later
maskEmailDate
New in version 16
maskEmailDate
maskEmailDate
The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, a RSS stream, ...
maskSystemDateThe format used corresponds to the format defined in the project description for the current language ("Project .. Project description", "Languages" tab).
WEBDEV - Browser code This constant is not available.
The 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 parameters 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 in parameter is checked. A message is displayed if the date is invalid. The validity of a date can be checked by DateValid.
The 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 linguistic options specified for the dates in the project description are taken into account if no specific format is defined.
To display the linguistic options of the project:
  1. Display the project description ("Project .. Project description").Display the project description: on the "Project" pane, in the "Project" group, click "Description".
  2. Select the "Language" tab.
For example:
  • if the project is using the linguistic options of Windows for the dates, the days of the week and the months will start with a lowercase character on a computer running a French version of Windows.
  • if the project is using specific parameters for the dates for one or more languages (custom name of the day or month, ...), 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.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
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
Jun. 29 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
Jan. 04 2018