Module lua-nucleo.datetime-utils

Date and time related utilities

This file is a part of lua-nucleo library

Info:

  • Copyright: lua-nucleo authors (see file COPYRIGHT for the license)

Local Functions

make_time_table (dom, mon, y, h, m, s) Converts function arguments to the associative array table and returns it.
get_days_in_month (year, month) Returns number of days in the given month of the given year.
get_day_of_week (timestamp) Returns a day of a week for the given timestamp.
day_of_week_name_to_number (v) Converts the given string to a day of a week.
month_name_to_number (v) Converts the given string to a month number.


Local Functions

make_time_table (dom, mon, y, h, m, s)
Converts function arguments to the associative array table and returns it.

Parameters:

  • dom number A day of a month.
  • mon number Month number by count.
  • y number Year.
  • h number Hour.
  • m number Minute.
  • s number Second.

Returns:

    table { day = dom; month = mon; year = y; hour = h; min = m; sec = s; }
get_days_in_month (year, month)
Returns number of days in the given month of the given year. (From http://lua-users.org/wiki/DayOfWeekAndDaysInMonthExample)

Parameters:

  • year number Year.
  • month number Month number by count.

Returns:

    number Number of days in the given month of the given year.
get_day_of_week (timestamp)
Returns a day of a week for the given timestamp. (From http://richard.warburton.it)

Parameters:

  • timestamp number Unix/POSIX time.

Returns:

    number Day of week, where zero is Sunday.
day_of_week_name_to_number (v)
Converts the given string to a day of a week.

Parameters:

  • v string Day of week string representation.

Returns:

    number Day of week, where zero is Sunday.
month_name_to_number (v)
Converts the given string to a month number.

Parameters:

  • v string Month string representation.

Returns:

    number Month number by count.
generated by LDoc 1.4.6 Last updated 2021-04-22 13:57:02