Convert C#/VB.NET Date/Time to Internal Date

When developing DotNet (.NET) applications, Date/Time objects are commonly used within business applications.  While the DateTime object give you a lot of functionality, it doesn’t have a native function to convert it back into a MultiValue Internal Date.

Since we always save dates in a compressed Internal formats within the MultiValue database, we have to convert the DateTime object into something we can store.

The easiest way to do this is to use the ICONV statement in the APIs provided by the database providers.

Dim _InternalDate As String
Dim _WinDate As Date = Now
_InternalDate = session.Iconv(_WinDate.ToShortDateString, "D")


While this is straight forward, there is a lot of additional override that may not be required.  You can easily convert your Date/Time object without using ICONV statement.

To do this, we take advantage of the OA Date format provided by by the DateTime object.  The OA Date format is the number of days before or after midnight, December 30 1899.  This is very similar to the MultiValve Internal date format, except for what is considered the Zero Date.

Login to Read Complete Article.

Downloads:

menu
menu