Date calculations helper for CodeIgniter. Should rename it to moredate instead perhaps.
Get started by running:
php tools/spark install -v1.0.2 datecalc
If you don't use the autoload feature, load the spark with
$this->load->spark('datecalc/1.0.2');
from your controller or model.
The following functions are currently included:
Return the number of days between two dates.
-
$start: the start date formatted as 'YYYY-MM-DD'.
-
$end: the end date formatted as 'YYYY-MM-DD'.
-
returns: the dates between as strings formatted as 'YYYY-MM-DD'.
Return the year as an integer of the given epoch timestamp.
-
$date: the epoch timestamp, defaults to time() if omitted.
-
returns: integer representation of the year.
Return the month as an integer of the given epoch timestamp.
-
$date: the epoch timestamp, defaults to time() if omitted.
-
returns: integer representation of the month.
Return the day-of-month as an integer of the given epoch timestamp.
-
$date: the epoch timestamp, defaults to time() if omitted.
-
returns: integer representation of the day-of-month.
Returns a string representation of a time span.
Based on this: css-tricks.com/snippets/php/time-ago-function
-
$tm: the epoch timestamp to compare with.
-
$rcs: recursion controller, gives some level of "resolution" to the result (3 weeks, 2 days, 14 minutes compared to 3 weeks, 2 days), play with it to see the results.
-
$lang: optional language parameter, defaults to 'en' for English, only options are ['en', 'sv'].
-
returns: time since supplied timestamp in a human readable form.