Class OCSP_DATE

Description

Date Class

Note: it seams that the php function mktime has problems with dates > 2037

Located in /common/OCSP_DATE.phpclass (line 34)


	
			
Variable Summary
 int $myDay
 int $myHour
 int $myMinute
 int $myMonth
 int $mySecond
 int $myYear
Method Summary
 OCSP_DATE OCSP_DATE ([boolean $setNow = True])
 void add (int $sec)
 void addDays ( $days, int $sec, since 1)
 string dateStr ([string $aFormat = "r"], [boolean $debug = False])
 int diff (pcf_DATE $aDate, [char $granularity = 's'], [char $round = 0], [boolean $debug = False])
 void equal ( $aDate)
 boolean equalDate (OCSP_DATE $aDate)
 void getArray ()
 int getDay ()
 void getDayNameShort ([ $dayNr = -1], [ $lang = "DE"])
 int getDayOfWeek ()
 int getHour ()
 void getLinuxTime ()
 int getMinutes ()
 int getMonth (boolean $with2Digets)
 void getMonthName ([ $aMonth = 0], [ $lang = "DE"])
 string getMonthNameShort ()
 int getSeconds ()
 int getWeekDay ()
 int getWeekNr ()
 int getYear ()
 void iCalDecoder ( $file)
 array isHoliday ([string $country = "AT"])
 boolean isInFutur ()
 boolean isInPast ()
 boolean isLeapYear ()
 boolean isNULL ()
 boolean isWorkDay ()
 void setDateStr (string $aString, [boolean $debug = False])
 void setDay ( $aDay, int $aMonth)
 boolean setDbString (string $dbValue, [boolean $debug = False])
 boolean setFromArray ( $dateArray, [boolean $debug = False], array $dataArray)
 boolean setLinuxTime ([ $aTime = 0])
 void setLinuxTimeStamp ([ $aTime = 0])
 void setMonday ()
 void setMondayOfWeek (int $week, [int $year = 0])
 void setMonth (int $aMonth)
 void setMySqlTimeStamp (string $mysql_timestamp)
 void setNow ()
 void setNULL ()
 void setTimeStr ( $aString)
 void setYear (int $aYear)
 void subtract (int $sec)
 void subtractDays ( $days, int $sec)
Variables
int $myDay (line 52)
  • access: protected
int $myHour (line 58)
  • access: protected
int $myMinute (line 64)
  • access: protected
int $myMonth (line 46)
  • access: protected
int $mySecond (line 70)
  • access: protected
int $myYear (line 40)
  • access: protected
Methods
Constructor OCSP_DATE (line 81)

constructor

  • access: public
OCSP_DATE OCSP_DATE ([boolean $setNow = True])
  • boolean $setNow: (if true the current timestamp is set to the object
add (line 915)

add $sec seconds to the date

  • todo: check if date is > 2037
void add (int $sec)
  • int $sec
addDays (line 929)

add $days days to the date

  • todo: check if date is > 2037
void addDays ( $days, int $sec, since 1)
  • int $sec
  • since 1: pk-05-04-07
  • $days
dateStr (line 665)

returns the date as string with format $aFormat for $aFormat see http://at.php.net/manual/en/function.date.php

  • version: pk-06-08-18 check for NULL
  • version: pk-06-08-08 check if the year > 2036
  • todo: implement format according to: http://www.php.net/manual/en/function.date.php
string dateStr ([string $aFormat = "r"], [boolean $debug = False])
  • string $aFormat
  • boolean $debug
diff (line 888)

calculates the difference between two dates returns the rounded granularity between $this and a Date

granularity values are:

  • s seconds
  • i minutes
  • h hours
  • d days
  • m month
  • y year

  • version: pk-06-07-17 granularity added
  • todo: check if date is > 2037
int diff (pcf_DATE $aDate, [char $granularity = 's'], [char $round = 0], [boolean $debug = False])
  • pcf_DATE $aDate
  • char $granularity
  • char $round
  • boolean $debug
equal (line 966)
  • todo: check if date is > 2037
void equal ( $aDate)
  • $aDate
equalDate (line 981)

returns if to date objectes have the same date;

boolean equalDate (OCSP_DATE $aDate)
getArray (line 696)
void getArray ()
getDay (line 459)

returns the day (of month [1..31])

int getDay ()
getDayNameShort (line 528)
void getDayNameShort ([ $dayNr = -1], [ $lang = "DE"])
  • $dayNr
  • $lang
getDayOfWeek (line 479)

returns the day of the week (0 Sunday,1 Monday,....6 Saturday)

taken from: http://www.terra.es/personal2/grimmer/

int getDayOfWeek ()
getFirstMondayOfYear (line 371)

calculate the first monday of year due to ISO8601 and returns the linux timestamp of it

  • since: pk-06-03-08
double getFirstMondayOfYear ()
getHour (line 588)
  • since: pk-06-08-08
int getHour ()
getLinuxTime (line 152)
void getLinuxTime ()
getLinuxTimeStamp (line 160)
void getLinuxTimeStamp ()
getMinutes (line 599)
  • since: pk-06-08-08
int getMinutes ()
getMonth (line 255)

returns the month as integer (1..12)

  • version: pk-06-08-08
int getMonth (boolean $with2Digets)
  • boolean $with2Digets: add leading zero?
getMonthFirstWeekNr (line 358)

returns the ISO-8601 week number of the week of the 1st day of a month

  • since: pk-06-06-05
int getMonthFirstWeekNr ()
getMonthName (line 279)
void getMonthName ([ $aMonth = 0], [ $lang = "DE"])
  • $aMonth
  • $lang
getMonthNameShort (line 294)

returns a short monthname (4 letters or 3 letter and dot)

  • since: pk-04-03-10
string getMonthNameShort ()
getMonthNofDays (line 309)

returns the days of the current month

  • since: pk-07-10-20
int getMonthNofDays ()
getMySqlTimeStamp (line 639)
void getMySqlTimeStamp ()
getSeconds (line 610)
  • since: pk-06-08-08
int getSeconds ()
getWeekDay (line 429)

Numeric representation of the day of the weekday

  1. (for Sunday) through 6 (for Saturday)

  • version: pk-05-12-23
int getWeekDay ()
getWeekNr (line 345)

returns the ISO-8601 week number

  • since: pk-06-06-05
int getWeekNr ()
getYear (line 214)

returns the year as integer (4 digets)

int getYear ()
iCalDecoder (line 992)

* ical methods

void iCalDecoder ( $file)
  • $file
isHoliday (line 545)

returns if the current date is a holiday

  • return: (the ical entry)
  • global: $OCSP_VAL $OCSP_VAL:
array isHoliday ([string $country = "AT"])
  • string $country
isInFutur (line 841)

checks if the current date is in futur

  • version: pk-07-11-19 $this->myYear > 2037 save
boolean isInFutur ()
isInPast (line 812)

checks if the current date is in past

  • version: pk-07-11-19 $this->myYear > 2037 save
boolean isInPast ()
isLeapYear (line 234)

returns if $this->myYear is a leap year (feb 29 days)

  • since: pk-06-07-17
boolean isLeapYear ()
isNULL (line 111)

returns if the Date is null

NOTE: if year is 0 and day or month lower 1 the date is considered as null

  • version: pk-05-07-17
  • version: pk-06-08-08 $this->myYear == 0 &&
  • version: pk-06-11-27 return true if ((intval($this->myDay) < 1) || (intval($this->myMonth) < 1))
boolean isNULL ()
isWorkDay (line 443)

returns if the day is a workday or not returns True for Monday - Friday returns False for Saturday, Sunday and holidays

  • version: pk-05-12-23
boolean isWorkDay ()
setDateStr (line 762)

sets the date from a date string with yyyy-MM-dd [HH:mm:ss] format

void setDateStr (string $aString, [boolean $debug = False])
  • string $aString
  • boolean $debug: since pk-05-03-30
setDay (line 468)

sets the day

  • since: pk-06-04-20
void setDay ( $aDay, int $aMonth)
  • int $aMonth
  • $aDay
setDbString (line 172)

sets the date from a db string

boolean setDbString (string $dbValue, [boolean $debug = False])
  • string $dbValue
  • boolean $debug
setFromArray (line 723)

sets the date from an array with at least YEAR set if $dataArray is not an array or $dateArray['YEAR'] is not set the object is set to null and False is returned

  • version: pk-06-08-08
boolean setFromArray ( $dateArray, [boolean $debug = False], array $dataArray)
  • array $dataArray
  • boolean $debug
  • $dateArray
setLinuxTime (line 136)

sets the date to a linux timestamp

  • var: if 0 -> the date is set to NULL
  • return: True if not zero else false
boolean setLinuxTime ([ $aTime = 0])
  • $aTime
setLinuxTimeStamp (line 156)
void setLinuxTimeStamp ([ $aTime = 0])
  • $aTime
setMonday (line 406)

sets to the Monday 00:00:00 of the current week

  • since: pk-06-03-09
void setMonday ()
setMondayOfWeek (line 391)

sets to the Monday in week (ISO8601)

  • since: pk-06-03-08
void setMondayOfWeek (int $week, [int $year = 0])
  • int $week
  • int $year
setMonth (line 263)

sets the month

void setMonth (int $aMonth)
  • int $aMonth
setMySqlTimeStamp (line 626)

sets the current date out of a mysql timestamp value

void setMySqlTimeStamp (string $mysql_timestamp)
  • string $mysql_timestamp: (YYYYMMDDHHMMSS)
setNow (line 94)
void setNow ()
setNULL (line 85)
void setNULL ()
setTimeStr (line 793)
void setTimeStr ( $aString)
  • $aString
setYear (line 222)

sets the year as integer (4 digets)

void setYear (int $aYear)
  • int $aYear
subtract (line 944)

subtract $sec seconds from the date

  • todo: check if date is > 2037
  • since: pk-05-04-07
void subtract (int $sec)
  • int $sec
subtractDays (line 958)

subtract $days from the date

  • todo: check if date is > 2037
  • since: pk-05-04-07
void subtractDays ( $days, int $sec)
  • int $sec
  • $days

Documentation generated on Thu, 08 Jan 2009 17:45:26 +0100 by phpDocumentor 1.4.0a2