Bunoon: TESS | Manual | Date

This area contains a set of functions that are used for handling and manipulating Date objects, while offering support for other useful tools, such as being able to get the total number of days in a month, working out if the year is a leap year, being able to get the extension type to use on a day, etc.

Takes a date and clones it as a return value.

The main arguments for this function are as follows:

  • oDate [Date] - The date that should be cloned.

The return value for this function is as follows:

  • [Date] - A cloned date (or the object passed itself if not valid).

Below is an example of how to use this function:

var oNewDate = new Date();


var oCloneDate = $T.Date.Clone(oNewDate);

Takes a day number and returns the correct extension that should follow it (st, nd, rd or th).

The main arguments for this function are as follows:

  • nDay [Number] - The day number that should be checked.
  • aExtensions [Array] - The strings array that should be applied (defaults to ["st", "nd", "rd", "th"]).

The return value for this function is as follows:

  • [Object] - A string containing the extension (or null if any error has occurred).

Below is an example of how to use this function:

var sExtension = $T.Date.GetExtension(15);

Takes a date and works out the total number of days there are in the current month.

The main arguments for this function are as follows:

  • oDate [Date] - The date that should be checked.

The return value for this function is as follows:

  • [Object] - A number containing the number the days (or null if any error has occurred).

Below is an example of how to use this function:

var nDaysInMonth = $T.Date.GetDaysInMonth(new Date());

Determines if a year passed is a leap year or not.

The main arguments for this function are as follows:

  • nYear [Number] - The value that should be checked.

The return value for this function is as follows:

  • [Boolean] - A boolean of true/false.

Below is an example of how to use this function:

var bIsLeapYear = $T.Date.IsLeapYear(2012);

Takes a value (in seconds) and converts it into a proper time.

The main arguments for this function are as follows:

  • nValue [Number] - The value that should be converted.

The return value for this function is as follows:

  • [Object] - A string containing the formatted time (or null if any error has occurred).

Below is an example of how to use this function:

var sTime = $T.Date.GetTimeFromSeconds(86400);