Brecham.Obex — An OBEX library for the .NET Framework

ObexHeaderConverter.DateTimeAsIso8601ByteSeq Method 

Converts a DateTime into a Byte array containing ASCII encoded text, to be carried in a Byte Sequence Header type.

[Visual Basic]
Public Shared Function DateTimeAsIso8601ByteSeq( _
   ByVal value As Date _
) As Byte()
[C#]
public static byte[] DateTimeAsIso8601ByteSeq(
   DateTime value
);

Parameters

value
The DateTime to be converted.

Return Value

A Byte array containing the date and time value in the defined format.

Remarks

This is the conversion as described in OBEX13.pdf Section 2.2.5, regarding the format for the “Time” header. This creates as ASCII string with the date and time formatted in ISO 8601 style as YYYYMMDDTHHDDMMSS, with a final letter Z if the date and time are in UTC. It is not specified there, but we can see from the example in section 9.2.4 that the string should not be null-terminated.

DateTime has three defined ‘kinds’ (DateTimeKind): Unspecified, Utc, and Local. We mark the time as UTC only if the DateTime passed is of ‘kind’ Utc. This of course applies only to framework version 2 and later.

See Also

ObexHeaderConverter Class | Brecham.Obex Namespace | DateTimeFromIso8601ByteSeq