|
- Validity of the date
- Date format
- Special case: is not specified
<Date type>.ToString (Function) In french: <Type Date>.VersChaîne Formats the specified date into the specified format. Tip: If the formatted date contains the "/" characters, it must not be displayed it in a Date edit control.
MyDate is Date MyDate = "20191225" Res = MyDate.ToString() // Res = "25/12/2019" Res = MyDate.ToString("MM-DD-YYYY") // Res = "12-25-2019" Res = MyDate.ToString("The number of day DD of month MM of year YYYY") MyDate = DateSys() Res = MyDate.ToString(maskDateSystem) // Res is using the format defined in the project
MyDate is Date MyDate = "20031202" // The case used for the days and for the months depends on the linguistic options of the project Res = MyDate.ToString("DDD DD MMM YYYY") // Res = "tue. 02 dec. 2003" or "Tue. 02 Dec. 2003" Res = MyDate.ToString("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 = MyDate.ToString("Ddd DD Mmm YYYY") // Res = "Tue. 02 Dec. 2003" Res = MyDate.ToString("Dddd DD Mmmm YYYY") // Res = "Tuesday 02 December 2003"
MyDate is Date MyDate = "20191125" Res = MyDate.ToString(maskDateEmail) // Returns "Mon, 25 Nov 2019 00:00:00 +0100" Res = MyDate.ToString(maskDateEmail) // Returns "Sun, 25 Aug 2019 00:00:00 +0200"
MyDate is Date MyDate = "20121125" Res = MyDate.ToString(maskDateEmail) // Returns "Sun, 25 Nov 2012 00:00:00 +0100" Res = MyDate.ToString(maskDateEmail) // Returns "Sat, 25 Aug 2012 00:00:00 +0200"
MyDate is Date MyDate = "20130101" // The date is 01/22/2013 Res = MyDate.ToString(maskDateRelativeDuration) // Returns: 3 weeks ago Res = MyDate.ToString(maskDateRelativeDuration) // Returns: in 10 months Res = MyDate.ToString(maskDateRelativeDuration) // Returns: last week
Syntax
Converting a date into string Hide the details
<Result> = <Date>.ToString([<Format>])
<Result>: Character string Character string in the specified format. <Date>: Date variable Name of the Date variable to convert. <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.
This notation is not available in browser code. - Mmm represent the month in letters on 3 characters with the first letter forced in uppercase (for example: Jan)
    This notation is not available.    This notation is not available. This notation is not available. - mmm represent the month in letters on 3 characters with the first letter forced in lowercase (for example: jan)
    This notation is not available.    This notation is not available. 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.
This notation is not available in browser code. - Mmmm represent the full month in letters with the first letter forced in uppercase (for example: January)
    This notation is not available.    This notation is not available.
This notation is not available. - mmmm represent the full month in letters with the first letter forced in lowercase (for example: January)
    This notation is not available.    This notation is not available. 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.
This notation is not available in browser code. - Ddd represent the day in letters on 3 characters with the first letter forced in uppercase (for example: Mon)
    This notation is not available.    This notation is not available. This notation is not available. - ddd represent the day in letters on 3 characters with the first letter forced in lowercase (for example: Mon)
    This notation is not available.    This notation is not available. 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.
This notation is not available in browser code. - Dddd represent the full day in letters with the first letter forced in uppercase (for example: Monday).
    This notation is not available.    This notation is not available. This notation is not available. - dddd represent the full day in letters with the first letter forced in lowercase (for example: monday).
    This notation is not available.    This notation is not available. This notation is not available. - M represents the first letter of the day (for example: M,T,W,T,F,S,S).
    This notation is not available.    This notation is not available. If this parameter corresponds to the following constant: | | Versions 18 and latermaskDateRelativeDuration New in version 18maskDateRelativeDuration 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:- On the "Project" pane, 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 <Date type>.ToString.
- for the controls that use the "Relative duration" display mask.
| Versions 16 and latermaskEmailDate New in version 16maskEmailDate maskEmailDate | The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, a RSS stream, ... The result is expressed in the local time zone. | Versions 25 and latermaskDateEmailUTC New in version 25maskDateEmailUTC maskDateEmailUTC | The format used corresponds to the date format of the RFC-5322 standard used to encrypt an email, a RSS stream, ... The result is expressed in universal time (UTC). | Versions 25 and latermaskDateInternet New in version 25maskDateInternet 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 latermaskDateInternetUTC New in version 25maskDateInternetUTC maskDateInternetUTC | The format used corresponds to the RFC-3339 standard used for international communications. The result is expressed in universal time (UTC). | maskSystemDate | The format used corresponds to the format defined in the project description for the current language ("Project .. Project description", "Languages" tab).The format used corresponds to the format defined in the project description for the current language: - On the "Project" pane, in the "Project" group, click "Description".
- Select the "Languages" tab then the "Date" tab.
- 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. 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 with DateValid.
The storage format allows you to store dates from 01/01/0001 to 12/31/9999. Date format <Date type>.ToString 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 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: - Display the project description ("Project .. Project description").Display the project description: on the "Project" pane, in the "Project" group, click "Description".
- 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.
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |