Lua methods for handling dates and times

695 views
Skip to first unread message

marbux

unread,
Apr 29, 2011, 2:21:06 AM4/29/11
to Notecase Pro
Date/Time Handling with Lua

This message collects some Lua methods I found on the web for handling
dates and times.

See also in the Help file scriptable program commands that can also
handle dates and times under the Date Property Commands and Custom
Property Commands topics, as well as the ExpiryDateSupport and
Timestamp.lua scripts by Daniel Hertrich, downloadable from
<http://notecasepro.com/scripting.php>.

Date Formatting Functions

Lua-Users Wiki, Date Formatting Functions.
<http://lua-users.org/wiki/DateFormattingFunctions>.

A collection of functions for formatting dates in reports or
converting dates between different formats when importing data.


Day Of Week And Days In Month Example

Lua-Users Wiki, Day Of Week And Days In Month Example.
<http://lua-users.org/wiki/DayOfWeekAndDaysInMonthExample>. Date
functions that include calculating the number of days in a given month
and the day of week for a given calendar day.

See also Display Calendar In Html below, which includes a function for
extending the above examples to generate a calendar formatted as an
HTML table.

Display Calendar In Html

Lua-Users Wiki, Display Calendar in HTML,
<http://lua-users.org/wiki/DisplayCalendarInHtml>. Two functions for
generating a calendar formatted as an HTML table.

Finding the Right Date Format

Lua Forge, Finding the Right Date Format.
<http://snippets.luacode.org/snippets/Finding_the_right_date_format_103>.
A Lua script to look up date codes for use in fetching dates using
Lua's os.execute command.

Rosetta Code Lua Snippets

RosettaCode.org. Includes links to snippets for date handling:

Date format, <http://rosettacode.org/wiki/Date_format>
Date manipulation, <http://rosettacode.org/wiki/Date_manipulation>
Day of the week, <http://rosettacode.org/wiki/Day_of_the_week>
Leap year, <http://rosettacode.org/wiki/Leap_year>

Time Zone Function

Lua-Users Wiki, Time Zone, <http://lua-users.org/wiki/TimeZone>.
Platform-neutral Lua function that returns a timezone string in the
form +hhmm or -hhmm.

Unit Conversion Function

"This code provides a convert_to function that converts between any
two units on a scale defined in a table in pairs of {name, equivalent
number of previous unit}. The example given is time, but it can be
adapted for Imperial units, military divisions, pre-decimalisation
British pounds, or any other incremental system of measurement."

<http://lua-users.org/wiki/UnitConversion>

Best regards,

Paul

Miro

unread,
Apr 29, 2011, 7:41:35 AM4/29/11
to Notecase Pro
Quite useful, thank you Paul.

Regards,
Miro

regex

unread,
May 6, 2011, 4:12:44 AM5/6/11
to noteca...@googlegroups.com
This happens at the right moment: I'm extending NoteCase as a task
manager (extensions with lua script is one the best feature of Notecase)
and some of these fonctions are smarter that mine !

(And now I can put them in a library ;-) )

Regards
Gerard

marbux

unread,
May 6, 2011, 10:22:55 AM5/6/11
to notecase-pro
On Fri, May 6, 2011 at 1:12 AM, regex <re...@wanadoo.fr> wrote:
> This happens at the right moment: I'm extending NoteCase as a task manager
> (extensions with lua script is one the best feature of Notecase) and some of
> these fonctions are smarter that mine !

You might also take a look at this project.
<http://luaforge.net/projects/date/>. It's described as follows on
LuaRocks:

"Pure Lua Date & Time module for Lua 5.x featuring date and Time
string parsing, time addition & subtraction, time span calculation,
support for ISO 8601 Dates, local time support, strftime-like
formatting. "

I haven't evaluated it.

Best regards,

Paul

Reply all
Reply to author
Forward
0 new messages