- Validity of the date
- Date format
- Special case: is not specified
DateToString (Function) In french: DateVersChaîne
Res = DateToString("20191225")
Res = DateToString(IntegerToDate(73773))
DateToString("")
Res = DateToString("20191225", "MM-DD-YYYY")
Res = DateToString("20791225", "Day # DD of the month # MM, YYYY")
Res = DateToString(DateSys(), maskDateSystem)
Res = DateToString("20031202", "DDD DD MMM YYYY")
Res = DateToString("20031202", "DDDD DD MMMM YYYY")
Res = DateToString("20031202", "Ddd DD Mmm YYYY")
Res = DateToString("20031202", "Dddd DD MMMM YYYY")
Res = DateToString("20191125", maskDateEmail)
Res = DateToString("20190825", maskDateEmail)
Res = DateToString("20191125", maskDateEmailUTC)
Res = DateToString("20190825", maskDateInternet)
Res = DateToString("20190825", maskDateInternetUTC)
Res = DateToString("20190101", maskDateRelativeDuration)
Res = DateToString("20191125", maskDateRelativeDuration)
Res = DateToString("20190118", maskDateRelativeDuration)
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 with 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 language options of the project.
- Mmm represents a 3-letter month with the first letter in uppercase (e.g., Jan)
This notation is not available. - mmm represents a 3-letter month with the first letter in lowercase (e.g., jan)
This notation is not available. - MMMM represents the month as a full name (e.g., January). The case used depends on the language options of the project.
This notation is not available. - mmmm represents the month as a full name with the first letter in lowercase (e.g., january)
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 language options of the project.
- Ddd represents a 3-letter day with the first letter in uppercase (e.g., Mon)
This notation is not available. - ddd represents a 3-letter day with the first letter in lowercase (e.g., mon)
This notation is not available. - DDDD represents the day as a full name (e.g., Monday). The case used depends on the language options of the project.
- Dddd represents the day as a full name with the first letter in uppercase (e.g., Monday).
This notation is not available. - dddd represents the day as a full name with the first letter in lowercase (e.g., monday).
This notation is not available. - M represents the first letter of the day (e.g., M,T,W,T,F,S,S).
If this parameter corresponds to the constant: | | maskDateEmail | The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, an RSS feed, etc, ... The result is expressed in the local time zone. | maskDateEmailUTC | The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, an RSS feed, etc, ... The result is expressed in universal time (UTC). | maskDateInternet | The format used corresponds to the date format of the RFC-3339 standard used for international communications. The result is expressed in the local time zone. | maskDateInternetUTC | The format used corresponds to the date format of the RFC-3339 standard used for international communications. The result is expressed in universal time (UTC). Not available. | maskDateRelativeDuration | This format expresses the time elapsed (or to elapse) between today's 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:- On the "Project" tab, in the "Project" group, click "Description".
- In the "Languages" tab:
- select the language to configure.
- select the "Date" tab.
- Click the "Dates and Times in natural language" button.
- 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.
Not available. | maskDateSystem | The format used corresponds to the format defined in the project description for the current language: - On the "Project" tab, in the "Project" group, click "Description".
- Select the "Languages" tab then the "Date" tab.
- 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.
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. 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. 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 view the project language options: - Open the project description: on the "Project" tab, in the "Project" group, click "Description".
- Select the "Languages" tab.
For example: - if the project uses the language 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:
|
Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
|
Business / UI classification: Neutral code
This page is also available for…
|
|
|