asp.net.ph

DateTime Structure

System Namespace


Represents an instance in time, typically expressed as a date and time of day.

DateTime Class Members

Collapse   Constructors

Visibility Constructor Parameters
public DateTime ( Int64 ticks )
public DateTime ( Int64 ticks , DateTimeKind kind )
public DateTime ( Int32 year , Int32 month , Int32 day )
public DateTime ( Int32 year , Int32 month , Int32 day , Calendar calendar )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second , DateTimeKind kind )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second , Calendar calendar )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second , Int32 millisecond )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second , Int32 millisecond , DateTimeKind kind )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second , Int32 millisecond , Calendar calendar )
public DateTime ( Int32 year , Int32 month , Int32 day , Int32 hour , Int32 minute , Int32 second , Int32 millisecond , Calendar calendar , DateTimeKind kind )

Collapse   Fields

Visibility Name Type
public static MaxValue DateTime
public static MinValue DateTime

Collapse   Properties

Visibility Name Value Type Accessibility
public Date DateTime [ Get ]
public Day Int32 [ Get ]
public DayOfWeek DayOfWeek [ Get ]
public DayOfYear Int32 [ Get ]
public Hour Int32 [ Get ]
public Kind DateTimeKind [ Get ]
public Millisecond Int32 [ Get ]
public Minute Int32 [ Get ]
public Month Int32 [ Get ]
public static Now DateTime [ Get ]
public Second Int32 [ Get ]
public Ticks Int64 [ Get ]
public TimeOfDay TimeSpan [ Get ]
public static Today DateTime [ Get ]
public static UtcNow DateTime [ Get ]
public Year Int32 [ Get ]

Collapse   Methods

Visibility Name Parameters Return Type
public Add ( TimeSpan value ) DateTime
public AddDays ( Double value ) DateTime
public AddHours ( Double value ) DateTime
public AddMilliseconds ( Double value ) DateTime
public AddMinutes ( Double value ) DateTime
public AddMonths ( Int32 months ) DateTime
public AddSeconds ( Double value ) DateTime
public AddTicks ( Int64 value ) DateTime
public AddYears ( Int32 value ) DateTime
public static Compare ( DateTime t1 , DateTime t2 ) Int32
public CompareTo ( DateTime value ) Int32
public CompareTo ( Object value ) Int32
public static DaysInMonth ( Int32 year , Int32 month ) Int32
public static Equals ( DateTime t1 , DateTime t2 ) Boolean
public Equals ( DateTime value ) Boolean
public Equals ( Object value ) Boolean
public static FromBinary ( Int64 dateData ) DateTime
public static FromFileTime ( Int64 fileTime ) DateTime
public static FromFileTimeUtc ( Int64 fileTime ) DateTime
public static FromOADate ( Double d ) DateTime
public GetDateTimeFormats ( IFormatProvider provider ) String
public GetDateTimeFormats ( ) String
public GetDateTimeFormats ( Char format , IFormatProvider provider ) String
public GetDateTimeFormats ( Char format ) String
public GetHashCode ( ) Int32
public GetTypeCode ( ) TypeCode
public IsDaylightSavingTime ( ) Boolean
public static IsLeapYear ( Int32 year ) Boolean
public static Parse ( String s , IFormatProvider provider , DateTimeStyles styles ) DateTime
public static Parse ( String s , IFormatProvider provider ) DateTime
public static Parse ( String s ) DateTime
public static ParseExact ( String s , String format , IFormatProvider provider , DateTimeStyles style ) DateTime
public static ParseExact ( String s , String format , IFormatProvider provider ) DateTime
public static ParseExact ( String s , String formats , IFormatProvider provider , DateTimeStyles style ) DateTime
public static SpecifyKind ( DateTime value , DateTimeKind kind ) DateTime
public Subtract ( TimeSpan value ) DateTime
public Subtract ( DateTime value ) TimeSpan
public ToBinary ( ) Int64
public ToFileTime ( ) Int64
public ToFileTimeUtc ( ) Int64
public ToLocalTime ( ) DateTime
public ToLongDateString ( ) String
public ToLongTimeString ( ) String
public ToOADate ( ) Double
public ToShortDateString ( ) String
public ToShortTimeString ( ) String
public ToString ( IFormatProvider provider ) String
public ToString ( String format , IFormatProvider provider ) String
public ToString ( ) String
public ToString ( String format ) String
public ToUniversalTime ( ) DateTime
public static TryParse ( String s , DateTime& result ) Boolean
public static TryParse ( String s , IFormatProvider provider , DateTimeStyles styles , DateTime& result ) Boolean
public static TryParseExact ( String s , String formats , IFormatProvider provider , DateTimeStyles style , DateTime& result ) Boolean
public static TryParseExact ( String s , String format , IFormatProvider provider , DateTimeStyles style , DateTime& result ) Boolean

Remarks

The DateTime value type represents dates and times with values ranging from 12:00:00 AM, 1/1/0001 CE ( Common Era ) to 11:59:59 PM, 12/31/9999 CE.

Time values are measured in 100-nanosecond units called "ticks", and a particular date is the number of ticks since 12:00 AM January 1, 1 CE in the GregorianCalendar calendar. For example, a ticks value of 31241376000000000L represents the date, Friday, January 01, 0100 12:00:00 AM. A DateTime value is always expressed in the context of an explicit or default calendar.

The DateTime and TimeSpan value types differ in that a DateTime represents an instance in time whereas a TimeSpan represents a time interval. This means, for example, that you can subtract one instance of DateTime from another to obtain the time interval between them. Or you could add a positive TimeSpan to the current DateTime to calculate a future date.

Time values can be added to, or subtracted from, an instance of DateTime. Time values can be negative or positive, and expressed in units such as ticks, seconds, or instances of TimeSpan. Methods and properties in this value type take into account details such as leap years and the number of days in a month.

Descriptions of time values in this type are often expressed using the coordinated universal time ( UTC ) standard, which was previously known as Greenwich Mean Time ( GMT ).

Calculations and comparisons of DateTime instances are only meaningful when the instances are created in the same time zone. For that reason, it is assumed that the developer has some external mechanism, such as an explicit variable or policy, to know in which time zone a DateTime instance was created. Methods and properties in this class always use the local time zone when making calculations or comparisons.

A calculation on an instance of DateTime, such as Add or Subtract, does not modify the value of the instance. Instead, the calculation returns a new instance of DateTime whose value is the result of the calculation.

This type inherits from IComparable, IFormattable, and IConvertible. Use the Convert class for conversions instead of this type's explicit interface member implementation of IConvertible.

See Also

TimeSpan   Calendar   GetUtcOffset 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