SetDateFormat Function | |
Change the setting that determines the X# date format.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION SetDateFormat(
cNewSetting AS STRING
) AS STRING
public static string SetDateFormat(
string cNewSetting
)
Request Example
View SourceParameters
- cNewSetting
- Type: String
The new date format to be set, in a string of 37 characters or less.
The date format can be specified in a number of ways, but must contain one or more occurrences of the letters D, M, and Y (respectively).
For example:
Return Value
Type:
String
TRUE if the argument is the same as the current setting; otherwise, FALSE.
Remarks
SetDateFormat() analyzes the new format specified by cNewSetting and determines both the proper placement and number of digits for the day, month, and year based on the D, M, and Y letters it finds.
SetDateFormat() is a global setting that affects the behavior of dates throughout a program, allowing you to control date formatting in a way that facilitates porting applications to foreign countries.
Examples
This example uses SetDateFormat() to set a date format:
1FUNCTION T()
2 LOCAL x AS STRING
3 ? GetDateFormat()
4 x:="DD-ABC-YYYY-123-MM"
5 ? x
6 SetDateFormat(x)
7 ? GetDateFormat()
8 ? TODAY()
9 ? 00.00.00
10 ? CTOD("31.1992.12")
11 ? CTOD(NULL_STRING)
12 SetCentury(FALSE)
13 ? GetDateFormat()
This example illustrates how SetDateFormat() can ignore or include the century digits:
1SetDateFormat("Year: YY, month: MM, day: DD")
2? SetCentury()
3SetDateFormat("DD. day of month MM in the Year YYYY")
4? SetCentury()
See Also