category OSS
package OSS_Date
copyright Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland
license New BSD License

 Methods

Takes a date string and returns with it as "yyyy-mm-dd".

ISOdate(string $date) : string
Static

The Input can be in "yyyy-mm-dd" or "dd/mm/yyyy" format, where the year can be two or four characters, and both the month and day can be one or two characters. It also takes and formats the time part.

Parameters

$date

string

Returns

string

Returns with the difference between two dates in days.

dateDiffDays(string $date1, string $date2) : int
Static

Parameters

$date1

string

default null if null then it will take the current date

$date2

string

default null if null then it will take the current date

Returns

int

Returns with the difference between two dates in months.

dateDiffMonths(string $date1, string $date2) : int
Static

Parameters

$date1

string

default null if null then it will take the current date

$date2

string

default null if null then it will take the current date

Returns

int

Returns with the difference between two dates in years.

dateDiffYears(string $date1, string $date2) : int
Static

Parameters

$date1

string

default null if null then it will take the current date

$date2

string

default null if null then it will take the current date

Returns

int

Converts seconds to hours, minutes and seconds.

secondsToHMS(int $seconds) : array
Static

Returns with an associative array having the keys 'hours', 'minutes' and 'seconds'.

Parameters

$seconds

int

Returns

array

Converts seconds to "A hours B minutes C seconds" string, skipping the unnecessary parts, like it won't return with "0 hours 0 minutes 34 seconds" but with "34 seconds".

secondsToTimeString(int $seconds) : string
Static

Parameters

$seconds

int

Returns

string