Date & Time Functions

All Date & Time functions are mapped on the DT table. These functions are used to manipulate dates & times.



  • DT.DateToDays(dd, mm, yy)
  • DT.DaysToDate(days, format)
  • DT.IsLeap(Year)
  • DT.MillisecondsToTime(MS, decimal)
  • DT.MinutesToTime(mins)
  • DT.MonthToNumber(month)
  • DT.NDate_AddDays(dd, mm, yy, days)
  • DT.NumberToMonth(month)
  • DT.SDate_AddDays(sDate, days)
  • DT.SecondsToTime(secs)
  • DT.TEST()
  • DT.TimeToMinutes(Tim)
  • DT.TimeToSeconds(Tim)


DT.DateToDays(dd, mm, yy)

result = DT.DateToDays(dd, mm, yy)

Converts the given date into days count starting from year 0. You can supply the date using the three parameters 'dd', 'mm', 'yy' or you can pass a string with a date in standard Hollywood format into the argument 'dd'.

INPUT

  • dd : Days of the date we want to convert or a string in the format dd-mmm-yyyy
  • mm : Month of the date we want to convert
  • yy : Year of the date we want to convert

OUTPUT

  • result : Date representation in days.


DT.DaysToDate(days, format)

result = DT.DaysToDate(days, format)

Converts the number of 'days' since year 0 to a date. With 'format' you can specify if you need a data with separated fields or a data string in standard Hollywood format. | |

INPUT

  • days : Number of days to convert into a date
  • format : The output date format:
    → #DT_FORMAT_SEPARATED : You will get dd, mm and yy variables
    → #DT_FORMAT_STANDARD : You will get dd-mmm-yyyy string

OUTPUT

  • result : The result of the conversion


DT.IsLeap(Year)

result = DT.IsLeap(year)

Return if the given 'year' is leap or not.

INPUT

  • year : The year to check

OUTPUT

  • result : True if the given leaop is True, otherwise False.


DT.MillisecondsToTime(MS, decimal)

result = DT.MillisecondsToTime(ms, decimals)

Converts the 'ms' milliseconds to the format hh:mm:ss.
If you set 'decimals' to True the output format will be: hh:mm:ss.dddd

INPUT

  • ms : The amount of milliseconds to convert
  • decimals : Set to True to include decimals into the conversion

OUTPUT

  • result : The result of the conversion in the format:
    → hh:mm:ss If decimals = False
    → hh:mm:ss.dddd If decimals = True


DT.MinutesToTime(mins)

result = DT.MinutesToTime(mins)

Converts 'mins' in the standard time format (hh:mm).
Returns a string representing the time in the format hh:mm, the hh value and the mm value.

INPUT

  • mins : Minutes count to convert

OUTPUT

  • result : A string in the hh:mm format


DT.MonthToNumber(month)

result = DT.MonthToNumber(month)

Returns the month number associated with the month string <month>, it must be a three character month name (in english), in the standard Hollywood format. |

INPUT

  • month : Month to convert (Jan, Feb, Mar, Apr, …)

OUTPUT

  • result : Month number or 0 if 'month' is not recognized.


DT.NDate_AddDays(dd, mm, yy, days)

result = DT.NDate_AddDays(dd, mm, yy, days)

Returns 'dd', 'mm' and 'yy' date with number of 'days' added.

INPUT

  • dd : Days part of the date
  • mm : Months part of the date
  • yy : Year part of the date
  • days : The number of days we want to add

OUTPUT

  • dd : The days part of the date after the addition
  • mm : The month part of the date after the addition
  • yy : The year part of the date after the addition


DT.NumberToMonth(month)

result = DT.NumberToMonth(monthNum)

Returns the month name associated with the 'month' number.
The returned month name will be in short format (three characters) in the standard Hollywood format.

INPUT

  • monthNum : Month number to convert

OUTPUT

  • result : Month string


DT.SDate_AddDays(sDate, days)

result = DT.SDate_AddDays(sDate, days)

Returns a string with the date 'sDate' plus the number of days specified in 'days' argument.
'sDate'' must have the format dd-mmm-yyyy

INPUT

  • sDate : The date string in dd-mmm-yyyy format
  • days : The number of days to add to 'sDate'

OUTPUT

  • result : The result of the addition in dd-mmm-yyyy format


DT.SecondsToTime(secs)

result = DT.SecondsToTime(secs)

Converts the specified 'secs' seconds in a string representing the time in the standard format hh:mm:ss

INPUT

  • secs : Seconds to convert

OUTPUT

  • result : A string in the hh:mm:ss format


DT.TEST()

DT.TEST()

Function used to test the library and to provide examples.



DT.TimeToMinutes(Tim)

result = DT.TimeToMinutes(Tim)

Converts the given time string 'Tim' with the format hh:mm in minutes.

INPUT

  • Tim : The string to convert in hh:mm format

OUTPUT

  • result : The result in minutes


DT.TimeToSeconds(Tim)

result = DT.TimeToSeconds(Tim)

Convert a given time string 'tim' with the format hh:mm:ss to seconds.

INPUT

  • tim : A time string in the format hh:mm:ss

OUTPUT

  • result : Convertion to seconds
hollywoodlibs/datetime/functions.txt · Ultima modifica: 2016/11/08 08:51 da admin
CC Attribution-Noncommercial 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0