FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
date Class Reference

Public Member Functions

 end_of_week ($week, $year=NULL, $format= 'Y-m-d')
 Finds end of week and return it in given format.

Static Public Member Functions

static unix2dos ($timestamp=FALSE)
 Converts a UNIX timestamp to DOS format.
static dos2unix ($timestamp=FALSE)
 Converts a DOS timestamp to UNIX format.
static offset ($remote, $local=TRUE)
 Returns the offset (in seconds) between two time zones.
static seconds ($step=1, $start=0, $end=60)
 Number of seconds in a minute, incrementing by a step.
static minutes ($step=5)
 Number of minutes in an hour, incrementing by a step.
static hours ($step=1, $long=FALSE, $start=NULL)
 Number of hours in a day.
static ampm ($hour)
 Returns AM or PM, based on a given hour.
static adjust ($hour, $ampm)
 Adjusts a non-24-hour number into a 24-hour number.
static days ($month, $year=FALSE)
 Number of days in month.
static days_of_month ($month, $year=FALSE)
 Returns count of days of given month and year (optional) Similar to function days, but return only count (not array)
static months_array ($translate=TRUE)
 Returns array of months.
static months ()
 Number of months in a year.
static years ($start=FALSE, $end=FALSE)
 Returns an array of years between a starting and ending year.
static timespan ($time1, $time2=FALSE, $output= 'years, months, weeks, days, hours, minutes, seconds')
 Returns time difference between two timestamps, in human readable format.
static round_month ($day=1, $month=1, $year=1970, $on_last_day=false)
 Round date to whole months, if count of days is more or equal to 15, increments count of months.
static month ($date= '0000-00-00')
 Function is similar to round_month, except it gets date in date format.
static get_closses_deduct_date_to ($date)
 Function returns date of new deduct from the given date.
static get_next_deduct_date_to ($date)
 Function returns next date of deduct from the given date.
static get_deduct_day_to ($month, $year)
 Calculate deduct day of given month.
static diff_month ($date_a= '0000-00-00', $date_b= '0000-00-00')
 Function to finding difference between 2 dates.
static create ($day, $month, $year, $hour=0, $minute=0, $second=0, $datetime=FALSE)
static pretty ($datetime)
 Function to return date in pretty format from datetime.
static pretty_time ($datetime)
static pretty_month ($datetime= '0000-00-00')
static from_interval ($interval=0, $unit= 'hours')
static mail_time ($datetime)
 Function to get time for mail (Google style)
static diff ($date1, $date2)
 Returns diff between 2 datetimes.
static interval ($date1, $date2= '0000-00-00 00:00:00')
 Returns interval (in array) between 2 datetimes.
static day_diff ($date1, $date2= '0000-00-00 00:00:00')
static hour_diff ($date1, $date2= '0000-00-00 00:00:00')
static minute_diff ($date1, $date2= '0000-00-00 00:00:00')
static counter ($timestamp)
 Returns counter for timestamp.
static start_of_week ($week, $year=NULL, $format= 'Y-m-d')
 Finds start of week and return it in given format.
static decrease_day ($year, $month, $day)
 Decreases given date by one day.

Static Public Attributes

static $months

Member Function Documentation

static date::adjust (   $hour,
  $ampm 
)
static

Adjusts a non-24-hour number into a 24-hour number.

Parameters
integerhour to adjust
stringAM or PM
Returns
string
static date::ampm (   $hour)
static

Returns AM or PM, based on a given hour.

Parameters
integernumber of the hour
Returns
string
static date::counter (   $timestamp)
static

Returns counter for timestamp.

Author
Michal Kliment
Parameters
integer$timestamp
Returns
string
static date::create (   $day,
  $month,
  $year,
  $hour = 0,
  $minute = 0,
  $second = 0,
  $datetime = FALSE 
)
static
Author
Michal Kliment Creates date in format 'YYYY-mm-dd' from day, month and year
Parameters
$day
$month
$year
Returns
date
static date::day_diff (   $date1,
  $date2 = '0000-00-00 00:00:00' 
)
static
Author
Michal Kliment Function to get day diff between 2 datetimes
Parameters
string$datetime
Returns
number
static date::days (   $month,
  $year = FALSE 
)
static

Number of days in month.

Parameters
integernumber of month
integernumber of year to check month, defaults to the current year
Returns
array A mirrored (foo => foo) array of the days.
static date::days_of_month (   $month,
  $year = FALSE 
)
static

Returns count of days of given month and year (optional) Similar to function days, but return only count (not array)

Author
Michal Kliment
Parameters
numeric$month
numeric$year
Returns
numeric
static date::decrease_day (   $year,
  $month,
  $day 
)
static

Decreases given date by one day.

Used in Fio automatic import.

Author
Jiri Svitak
Parameters
<type>$year
<type>$month
<type>$day
static date::diff (   $date1,
  $date2 
)
static

Returns diff between 2 datetimes.

Author
Michal Kliment
Parameters
string$date1
string$date2
Returns
number
static date::diff_month (   $date_a = '0000-00-00',
  $date_b = '0000-00-00' 
)
static

Function to finding difference between 2 dates.

Parameters
$date_adate in format 'YYYY-mm-dd'
$date_bdate in format 'YYYY-mm-dd'
Returns
<type>
static date::dos2unix (   $timestamp = FALSE)
static

Converts a DOS timestamp to UNIX format.

Parameters
integerDOS timestamp
Returns
integer
date::end_of_week (   $week,
  $year = NULL,
  $format = 'Y-m-d' 
)

Finds end of week and return it in given format.

Author
Michal Kliment
Parameters
type$week
type$year
type$format
Returns
type
static date::get_closses_deduct_date_to (   $date)
static

Function returns date of new deduct from the given date.

If given day is before and including deduct day, then deduct day of current month is returned. If given day is after deduct day, then deduct day of next month is returned.

Author
Ondrej Fibich
Parameters
string$date
Returns
string
static date::get_deduct_day_to (   $month,
  $year 
)
static

Calculate deduct day of given month.

Author
Ondrej Fibich
Parameters
integer$month
integer$year
Returns
string
static date::get_next_deduct_date_to (   $date)
static

Function returns next date of deduct from the given date.

Next means that next mmonth deduct date is calculated.

Author
Ondřej Fibich fibic.nosp@m.h@fr.nosp@m.eenet.nosp@m.is.o.nosp@m.rg
Since
1.1.10
Parameters
string$dateinput deduct date
Returns
string next deduct date from next month
static date::hour_diff (   $date1,
  $date2 = '0000-00-00 00:00:00' 
)
static
Author
Michal Kliment Function to get hour diff between 2 datetimes
Parameters
string$datetime
Returns
number
static date::hours (   $step = 1,
  $long = FALSE,
  $start = NULL 
)
static

Number of hours in a day.

Parameters
integeramount to increment each step by
booleanuse 24-hour time
integerthe hour to start at
Returns
array A mirrored (foo => foo) array from start-12 or start-23.
static date::interval (   $date1,
  $date2 = '0000-00-00 00:00:00' 
)
static

Returns interval (in array) between 2 datetimes.

Author
Michal Kliment
Parameters
string$date1
string$date2
Returns
array
static date::mail_time (   $datetime)
static

Function to get time for mail (Google style)

Author
Michal Kliment
Parameters
string$datetime
Returns
string
static date::minute_diff (   $date1,
  $date2 = '0000-00-00 00:00:00' 
)
static
Author
Michal Kliment Function to get minute diff between 2 datetimes
Parameters
string$datetime
Returns
number
static date::minutes (   $step = 5)
static

Number of minutes in an hour, incrementing by a step.

Parameters
integeramount to increment each step by, 1 to 30
Returns
array A mirrored (foo => foo) array from 1-60.
static date::month (   $date = '0000-00-00')
static

Function is similar to round_month, except it gets date in date format.

Author
Jiri Svitak
Parameters
date
Returns
unknown_type
static date::months ( )
static

Number of months in a year.

Returns
array A mirrored (foo => foo) array from 1-12.
static date::months_array (   $translate = TRUE)
static

Returns array of months.

Parameters
bool$translateTranslate months names
Returns
array
static date::offset (   $remote,
  $local = TRUE 
)
static

Returns the offset (in seconds) between two time zones.

See Also
http://php.net/timezones
Parameters
stringtimezone that to find the offset of
string|booleantimezone used as the baseline
Returns
integer
static date::pretty (   $datetime)
static

Function to return date in pretty format from datetime.

Author
Michal Kliment
Parameters
string$datetime
Returns
string
static date::round_month (   $day = 1,
  $month = 1,
  $year = 1970,
  $on_last_day = false 
)
static

Round date to whole months, if count of days is more or equal to 15, increments count of months.

@param integer $day
Parameters
integer$month
integer$year
Returns
string
static date::seconds (   $step = 1,
  $start = 0,
  $end = 60 
)
static

Number of seconds in a minute, incrementing by a step.

Parameters
integeramount to increment each step by, 1 to 30
integerstart value
integerend value
Returns
array A mirrored (foo => foo) array from 1-60.
static date::start_of_week (   $week,
  $year = NULL,
  $format = 'Y-m-d' 
)
static

Finds start of week and return it in given format.

Author
Michal Kliment
Parameters
type$week
type$year
type$format
Returns
type
static date::timespan (   $time1,
  $time2 = FALSE,
  $output = 'years,
months  ,
weeks  ,
days  ,
hours  ,
minutes  ,
seconds  
)
static

Returns time difference between two timestamps, in human readable format.

Parameters
integertimestamp
integertimestamp, defaults to the current time
stringformatting string
Returns
string|array
static date::unix2dos (   $timestamp = FALSE)
static

Converts a UNIX timestamp to DOS format.

Parameters
integerUNIX timestamp
Returns
integer
static date::years (   $start = FALSE,
  $end = FALSE 
)
static

Returns an array of years between a starting and ending year.

Uses the current year +/- 5 as the max/min.

Parameters
integerstarting year
integerending year
Returns
array

Member Data Documentation

date::$months
static
Initial value:
array
(
1 => 'January',
2 => 'February',
3 => 'March',
4 => 'April',
5 => 'May',
6 => 'June',
7 => 'July',
8 => 'August',
9 => 'September',
10 => 'October',
11 => 'November',
12 => 'December'
)

The documentation for this class was generated from the following file: