Question

Before I used a framework, I'd often define things like so (so my code makes more sense to read)

define('MINUTE', 60);
define('HOUR', MINUTE * 60); // etc

Is anything like this built into Kohana 3, or should I specify this myself (perhaps in bootstrap.php)?

Was it helpful?

Solution

The Kohana 3 static class Date gives you access to these constants. View source.

Usage as follows

$week = Date::WEEK;
$year = Date::YEAR; // etc

OTHER TIPS

Kohana has a few date helpers but nothing for your specific need. Just declare it yourself!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top