Click or drag to resize

Bin2Date Function

Convert a string containing a 32-bit binary date to a date data type.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION Bin2Date(
	cString AS STRING
) AS DATE
View Source

Parameters

cString
Type: String
A 32-bit binary date represented as a string — least significant byte first.  Only the first 4 bytes are used by the function; all others are ignored.

Return Value

Type: Date
A date value that corresponds to the date specified in <cString>.  If <cString> is not a valid binary date, Bin2Date() returns a NULL_DATE.
Remarks
Bin2Date() is a conversion function that converts the first 4 bytes of a string to a date.  Typical applications include reading foreign file types in their native format then saving, reading, decrypting, and transmitting date types in their compressed binary form instead of in strings.  Its inverse is Date2Bin().
Examples
This example illustrate Bin2Date():
X#
? Bin2Date("!$%" + Chr(0))        // 03/09/52
This example shows the inverse relationship of Bin2Date() and Date2Bin():
X#
? Bin2Date(Date2Bin(Today()))        // Today's date
See Also