Date2Bin Function | |
Convert a date to a 32-bit binary date string.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION Date2Bin(
dValue AS DATE
) AS STRING
public static string Date2Bin(
Date dValue
)
Request Example
View SourceParameters
- dValue
- Type: Date
The date value to convert.
Return Value
Type:
StringRemarks
Date2Bin() is a conversion function that converts a date data type into a 4-byte string. Typical applications include reading foreign file types in their native format and then saving, reading, decrypting, and transmitting date types in their compressed binary form instead of in strings.
Its inverse is Bin2Date().
Examples
This example uses Date2Bin() to record today's date to a debugging file:
1FUNCTION RecordDate() AS LOGIC
2 LOCAL nh
3 LOCAL lSuccess := FALSE AS LOGIC
4 nh := FOpen2("debug.doc", FO_READWRITE)
5
6 IF nh != F_ERROR
7 FWrite(nh, Date2Bin(Today()))
8 FClose(nh)
9 lSuccess := TRUE
10 ELSE
11 ? "An error occurred when opening debug.doc"
12 ? FError()
13 ENDIF
14 RETURN lSuccess
See Also