|
- Validity of the date
- Date format
- Special case: is not specified
<Date type>.ToString (Function) In french: <Type Date>.VersChaîne Converts the specified date to the specified format. Tip: If the formatted date contains the "/" characters, it must not be displayed it in a Date edit control. Versions 26 and later New in version 26
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("Day # DD of the month # MM, YYYY") MyDate = DateSys() Res = MyDate.ToString(maskDateSystem) // Res uses 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" // You can force the use of uppercase letters for days and months 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 = "20190101" // As of 01/22/2019 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 to 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 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 laterMmm represents a 3-letter month with the first letter in uppercase (e.g., Jan) This notation is not available. New in version 16Mmm 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 uppercase (e.g., Jan)
This notation is not available. Versions 16 and latermmm represents a 3-letter month with the first letter in lowercase (e.g., jan) This notation is not available. New in version 16mmm represents a 3-letter month with the first letter in lowercase (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 linguistic options of the project.
This notation is not available.
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 <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 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: - Open the project description: on the "Project" pane, in the "Project" group, click "Description".
- 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.
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |