Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php defined('SYSPATH') OR die('No direct access allowed.');

/**
 * Extend the Kohana Date helper
 */
class Date extends Kohana_Date {

	/**
	 * Number of months in a year. Value will hold month name
	 * 
	 * @static
	 * @uses    Date::hours
	 * @return  array  Array from 1-12 with month names
	 */
	public static function months_with_name()
	{
		$months = Date::hours();

		for ($i = 1; $i <= 12; $i++)
		{
			$timestamp = mktime(0, 0, 0, $i, 1, 2005);
			$months[$i] = date("M", $timestamp);
		}

		return $months;
	}

	/**
	 * Checks whether a string is a date
	 *
	 * @static
	 * @param  string date
	 * @return bool
	 */
	public static function is_date($str)
	{
		return (boolean) strtotime($str);
	}

}

// End Date