Question
I am writing a small plugin and I need to tell the time lapsed since a certain date, which is passed to the plugin in the format: 13 Oct 2005.
Are there are TWiki core functions to:
- parse the date (the format is flexible),
- compute the number of days till "today"?
Or any other suggestions for me to proceed?
Thanks.
Environment
--
PankajPant - 24 Jan 2006
Answer
If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.
In addition to the various PERL functions available from CPAN and used in a variety of plugins that handle date parsting, there is also a
TimeSincePlugin. I'm using it in Dakar, I'm not sure how it fucntions in Cairo.
--
AntonAylward - 25 Jan 2006
Thanks for the tip. Date::Calc seems to have all that I need and much more.
--
PankajPant - 25 Jan 2006
You don't need to write a plugin or make use of Perl at all. The
SpreadSheetPlugin has
-
FORMATTIME( serial, text ) -- convert a serialized date into a date string
-
FORMATGMTIME( serial, text ) -- convert a serialized date into a GMT date string
-
TIME( text ) -- convert a date string into a serialized date number
-
TIMEADD( serial, value, unit ) -- add a value to a serialized date
-
TIMEDIFF( serial_1, serial_2, unit ) -- time difference between two serialized dates
-
TODAY( ) -- serialized date of today at midnight GMT
Why make work for yourself?
--
AntonAylward - 25 Jan 2006