Click or drag to resize

DToS Function

X#
Convert a date value to a string formatted as yyyymmdd.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DToS(
	dDate AS DATE
) AS STRING
Request Example View Source

Parameters

dDate
Type: Date
The date value to convert.

Return Value

Type: String
An 8-character string in the format yyyymmdd.
If dDate is a NULL_DATE, a string of eight spaces is returned.
The return value is not affected by the current date format.
Remarks
DToS() is a date conversion function that is used when creating order keys consisting of a date value and a string. DToS() converts a date value to a string that can be concatenated to any other string.
The return value is structured to preserve date order (year, month, and day).
Examples
These examples simply apply DToS() to a date:
X#
1? TODAY()                // 09/01/98
2? DTOS(TODAY())            // 19980901
This example applies DToS() to a date literal and reports its length:
X#
1? SLen(DTOS(0.0.0)            // 8
This example demonstrates how to create an order with a compound date and character key using DToS():
X#
1USE sales NEW
2INDEX ON DTOS(SaleDate) + LastName TO datename
See Also