asp.net.ph

DateTime Constructor ( Int64 )

System Namespace   DateTime Structure


Initializes a new instance of the DateTime structure to a specified number of ticks.

[ VB ]
<Serializable>
Public Sub New ( _
   ByVal ticks As Long _
)

[ C# ]
[ Serializable ]
public DateTime (
   long ticks
);

[ C++ ]
[ Serializable ]
public: DateTime (
   __int64 ticks
);

[ JScript ]
public Serializable
function DateTime (
   ticks : long
);

Parameters

ticks
A date and time expressed in 100-nanosecond units.

Exceptions


Exception Type Condition
ArgumentOutOfRangeException ticks is less than MinValue or greater than MaxValue.

Example

The following demonstrates using this constructor.

// create a new instance of DateTime containing the date
// 7/28/1979 at 10:35:05 PM using the en-US calendar.
System.Globalization.CultureInfo info =
   new System.Globalization.CultureInfo ( "en-US", false );

System.Globalization.Calendar calendar = info.Calendar;

System.DateTime dateTime =
   new System.DateTime ( 1979,      // Year
                  07,         // Month
                  28,         // Day
                  22,         // Hour
                  35,         // Minute
                  5,         // Second
                  15,         // Millisecond
                  calendar   // calendar
                   );

// Write the DateTime as "Saturday, July 28, 1979 10:35:05 PM".
System.Response.WriteLine ( "{ 0:F }", dateTime );
  C# VB

See Also

DateTime Members   DateTime Constructor Overload List Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph