NDateTime Structure

Constructors

Name Description
NDateTime(year, month, day, hours, minutes, seconds, milliseconds, jsDateObject)

Initializes a new instance of the NDateTime to a specified year, month, day, hours, minutes, seconds and milliseconds, passing null to jsDateObject.

You can also set all parameter to null except jsDateObject that will contains a javascript Date object. 

NDateTimeFromJsObject(jsDateObject)

Initializes a new instance of the NDateTime with a javascript Date object.

Properties available 

Name Description
Date Gets the date component of this instance.
Day Gets the day of the month represented by this instance.
DayOfWeek Gets the day of the week represented by this instance.
JavaScriptDateObject Gets the javascript date object represented by this instance.
Hour Gets the hour component of the date represented by this instance.
Millisecond Gets the milliseconds component of the date represented by this instance.
Minute Gets the minute component of the date represented by this instance.
Month Gets the month component of the date represented by this instance.
Second Gets the seconds component of the date represented by this instance.
TimeOfDay Gets the time of day for this instance. This property return an NTimeSpan object that represents the fraction of the day that has elapsed since midnight.
Year Gets the year component of the date represented by this instance.

 

Methods available

Name Description
AddDays Returns a new NDateTime that adds the specified number of days to the value of this instance.
AddHours Returns a new NDateTime that adds the specified number of hours to the value of this instance.
AddMilliseconds Returns a new NDateTime that adds the specified number of milliseconds to the value of this instance.
AddMinutes Returns a new NDateTime that adds the specified number of minutes to the value of this instance.
AddMonths Returns a new NDateTime that adds the specified number of months to the value of this instance.
AddSeconds Returns a new DateTime that adds the specified number of seconds to the value of this instance.
AddYears Returns a new DateTime that adds the specified number of years to the value of this instance.
CompareTo(NDateTime) Compares the value of this instance to a specified DateTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.
DaysInMonth Gets the number of days in the month of this instance.
IsLeapYear Returns an indication whether the specified year is a leap year.
ToString Converts the value of the current NDateTime object to its equivalent string representation.
ToString(format)

Converts the value of the current NDateTime object to its equivalent string representation using the specified format.

format : custom format string (example: "dd-MM-yyyy" or "dd/MM-yyyy")

 supported format specifier are :

  • "d"     : The day of the month, from 1 through 31.
  •  "dd"   : The day of the month, from 01 through 31.
  • "M"    : The month, from 1 through 12.
  • "MM" : The month, from 01 through 12.
  • "yyyy" : The year as a four-digit number.
  • "HH"   : The hour using a 24-hour clock from 00 to 23.
  • "H"     : The hour using a 24-hour clock from 0 to 23.
  • "mm"  : The minute, from 00 through 59.
  • "m"     : The minute, from 0 through 59.
  • "ss"     : The second, from 00 through 59. 
  • "s"      : The second, from 0 through 59.
  • "fff"    : The milliseconds in a date and time value.
  • "ff"     : The hundredths of a second in a date and time value.
  • "f"      : The tenths of a second in a date and time value.

Static methods available

Name Description
Now Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
Parse(value, format)

Converts the specified string representation of a date and time to its NDateTime equivalent using the specified format.

value: A string containing a date and time to convert.

format : Custom format string (example: "dd-MM-yyyy" or "dd/MM-yyyy")

supported format specifier are :

  • "d"     : The day of the month, from 1 through 31.
  • "dd"   : The day of the month, from 01 through 31.
  • "M"    : The month, from 1 through 12.
  • "MM" : The month, from 01 through 12.
  • "yyyy" : The year as a four-digit number.
  • "HH"   : The hour using a 24-hour clock from 00 to 23.
  • "H"     : The hour using a 24-hour clock from 0 to 23.
  • "mm"  : The minute, from 00 through 59.
  • "m"     : The minute, from 0 through 59.
  • "ss"     : The second, from 00 through 59. 
  • "s"      : The second, from 0 through 59.
Today Gets a DateTime object that is set to the current date on this computer.

Last edited Sep 22, 2013 at 1:57 PM by jeremydumais, version 6

Comments

No comments yet.