DelphiBasics
  Home  |  Delphi .net Home  |  System NameSpace
 .NET Framework
 Namespace References

 System
 
  Array  Class 
  Boolean  Structure 
  Buffer  Class 
  Byte  Structure 
  Char  Structure 
  Console  Class 
  Convert  Class 
  DateTime  Structure 
  DayOfWeek  Enumeration 
  Decimal  Structure 
  Double  Structure 
  Enum  Class 
  Environment  Class 
  Exception  Class 
  ICloneable  Interface 
  Int16  Structure 
  Int32  Structure 
  Int64  Structure 
  Math  Class 
  Object  Class 
  OperatingSystem  Class 
  Random  Class 
  SByte  Structure 
  Single  Structure 
  String  Class 
  TimeSpan  Structure 
  UInt16  Structure 
  UInt32  Structure 
  UInt64  Structure 
  Version  Class 
 System.Collections
 System.Globalization
 System.IO

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 php Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders


 
 
  System.DateTime Structure
 
 Description
The DateTime value type holds a date and time. The value may range from 00:00:00 on January 1, 0001 AD to 23:59:59 on December 31, 9999 AD according to the Gregorian Calendar.
 
Internally, the value is stored as a number of 100 nanosecond (0.0000001 second) ticks since 00:00:00 Jan 1 0001 AD.
 
Note: : The MSDN remarks about DateTime gives the start date/time as 01 Jan 0001 12:00:00 midnight.
 
DateTime values are never updated (the value is said to be immutable) - any changes always result in a new DateTime value being returned.
 
Use the TimeSpan to hold a time interval. For example, 2 hours, or 4 days plus 6 hours. A TimeSpan value can be added or subtracted from a DateTime value.
 
DateTime looks very much like a class - in .Net it is called a structure because it is always fixed in size, and can be more efficiently handled. It cannot be inherited from.
 
Note : You cannot assign to any of the properties - they are read only.
 Syntax
Constructor Create ( Ticks : Int64 ; );
Constructor Create ( Year : Integer; Month : Integer; Day : Integer );
Constructor Create ( Year : Integer; Month : Integer; Day : Integer; Cal : Calendar );
Constructor Create ( Year : Integer; Month : Integer; Day : Integer; Hour : Integer; Minute : Integer; Seconds : Integer );
Constructor Create ( Year : Integer; Month : Integer; Day : Integer; Hour : Integer; Minute : Integer; Seconds : Integer; Cal : Calendar );
Constructor Create ( Year : Integer; Month : Integer; Day : Integer; Hour : Integer; Minute : Integer; Seconds : Integer; MillSeconds : Integer );
Constructor Create ( Year : Integer; Month : Integer; Day : Integer; Hour : Integer; Minute : Integer; Seconds : Integer; MillSeconds : Integer; Cal : Calendar );
 Methods
Add  Adds a time-span to the date and time
AddDays  Adds a number of days to the date/time
AddHours  Adds a number of hours to the date/time
AddMilliseconds  Adds a number of milliseconds to the date/time
AddMinutes  Adds a number of minutes to the date/time
AddMonths  Adds a number of months to the date/time
AddSeconds  Adds a number of seconds to the date/time
AddTicks  Adds a number of ticks to the date/time
AddYears  Adds a number of years to the date/time
Compare  Compares two DateTime values
CompareTo  Compares the current DateTime value to another
DaysInMonth  Returns the number of days in the specified month of the specified year.
Equals  Returns true if DateTime values are exactly the same
IsLeapYear  Determines whether a year is a leap year
Parse  Converts a string representation of date and time into a DateTime value
ParseExact  Converts a string representation of date and time into a DateTime value
Subtract  Subtract a DateTime or TimeSpan from the current DateTime value
ToLongDateString  Converts the current DateTime to a long date format string
ToLongTimeString  Converts the current DateTime to a long time format string
ToShortDateString  Converts the current DateTime to a short date format string
ToShortTimeString  Converts the current DateTime to a short time format string
ToString  Converts the current DateTime to a string

 Fields
MaxValue  DateTime  Represents the largest possible value of DateTime. This field is read-only.
MinValue  DateTime  Represents the smallest possible value of DateTime. This field is read-only.
 Properties
Date  DateTime  Gets the date
Day  Integer  Gets the day of the month
DayOfWeek  DayOfWeek  Gets the day of the week
DayOfYear  Integer  Gets the day of the year
Hour  Integer  Gets the hour
Millisecond  Integer  Gets the milliseconds
Minute  Integer  Gets the minutes
Month  Integer  Gets the month
Now  DateTime  Gets a DateTime that is the current local date and time on this computer.
Second  Integer  Gets the seconds
Ticks  Int64  Gets the number of ticks that represent the date and time of this instance.
TimeOfDay  TimeSpan  Gets the time of day
Today  DateTime  Gets the current date
UtcNow  DateTime  Gets a DateTime that is the current local date and time on this computer expressed as the coordinated universal time (UTC).
Year  Integer  Gets the year
 Operators
+  Adds a specified time interval to a specified date and time, yielding a new date and time.
=  Determines whether two specified instances of DateTime are equal.
>  Determines whether one specified DateTime is greater than another specified DateTime.
>=  Determines whether one specified DateTime is greater than or equal to another specified DateTime.
<>  Determines whether two specified instances of DateTime are not equal.
<  Determines whether one specified DateTime is less than another specified DateTime.
<=  Determines whether one specified DateTime is less than or equal to another specified DateTime.
-  Overloaded. Subtracts a specified DateTime or TimeSpan from a specified DateTime.

 Delphi Basics links
 
System.DayOfWeek

 Microsoft MSDN links
 
System
System.datetime
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page