|
| | __construct ($lan='it', $dateFormat='it', $timeFormat='it', $separator='/') |
| |
| | _checkIniFile () |
| |
| | exitOnError () |
| |
| | _update () |
| |
| | _format () |
| |
| | _language () |
| |
| | _debug () |
| |
| | _disclaimer () |
| |
| | _isDaylight ($time) |
| |
| | dayToN ($day) |
| |
| | NToDay ($day) |
| |
| | monthToN ($month) |
| |
| | NToMonth ($month) |
| |
| | isDay ($data, $day) |
| |
| | dateToTimestamp ($date) |
| |
| | daysDiff ($data_ini, $data_fin) |
| |
| | weeksDiff ($data_ini, $data_fin) |
| |
| | monthsDiff ($data_ini, $data_fin) |
| |
| | yearsDiff ($data_ini, $data_fin) |
| |
| | timesDiff ($time_from, $time_to, $result_in="m") |
| |
| | timesAdd ($time, $add, $what) |
| |
| | howTo ($data) |
| |
| | howDays ($data_ini, $data_fin, $day) |
| |
| | kMkTime ($exp) |
| |
| | atomDate ($date, $atom) |
| |
| | kDate ($format="%l %d %F %Y", $timestamp=0) |
| |
| | operation ($operator, $date, $operand) |
| |
| | netTimestamp ($server='time-a.nist.gov', $port=37) |
| |
| | swatchTime () |
| |
| | mysql_time_easy ($timestamp, $mode='mysqlfrom') |
| |
| | getNthDay ($number, $weekday, $month, $year=0) |
| |
| | romanDate ($date) |
| |
| | yearMoonPhases ($Y) |
| |
| | todayMoonPhase ($date='') |
| |
| | getSunTime ($latitude=0, $longitude=0, $timezone=1, $location='IT|Roma', $daylight=1, $date='') |
| |
| | pg_time_easy ($timestamp) |
| |
| | timeToText ($seconds, $format="h") |
| |
| | secsToTime ($secs) |
| |
| | isValid ($date) |
| |
| | getInfo ($date, $what, $format="short") |
| |
| | InvertDate ($date=null) |
| |
| | CompareDate ($dateA, $operator, $dateB) |
| |
| | GetDay ($date) |
| |
| | GetMonth ($date) |
| |
| | GetYear ($date) |
| |
| | Between ($date1, $date, $date2) |
| |
| | makeTime () |
| |
| | getMonthByNumber ($number) |
| |
| | getLastDayOfMonth ($month, $year=NULL) |
| |
Class for compute some calculations on date and time
- Copyright
- 2002-2003 Holosoft - Tommaso D'Argenio rajas.nosp@m.i@zi.nosp@m.obudd.nosp@m.a.ne.nosp@m.t
- Versão
- $id class.kronos.php,v 0.7 2003/09/09 16.35.00(CET) marms Exp $ Holosoft Home Page http://lafucina.holosoft.it/kronoclass/ KronoClass Home at Author's Site http://www.phpclasses.org/browse.html/package/943.html KronoClass Home at phpclasses http://freshmeat.net/projects/kronoclass/?topic_id=914 KronoClass Home at freshmeat
◆ __construct()
| __construct |
( |
| $lan = 'it', |
|
|
| $dateFormat = 'it', |
|
|
| $timeFormat = 'it', |
|
|
| $separator = '/' ) |
Constructor @access public
- Veja também
- Krono::$dateFormat
- Parâmetros
-
| string | $lan | The language to use for month/day names |
| string | $dateFormat | the format for date |
| char | $separator | Character to use as date separator |
- Retorna
- void
◆ _checkIniFile()
Function that check if ini files for languages exists @access private @reutrn void
◆ _debug()
Print out some debug information @access: private
- Retorna
- void
◆ _disclaimer()
Print out a disclaimer @access private
- Retorna
- void
◆ _format()
Return the format string for date function according to dateFormat parameter and separator @access private
- Retorna
- string
◆ _isDaylight()
Return if a given time is daylight saving or not @access private
- Retorna
- int 1 if time is daylight saving 0 otherwise.
◆ _language()
Return the literal name of language code @access private
- Retorna
- string The long name of language format
◆ _update()
Return the last modified date of class file @access private
- Retorna
- string The formatted date of this file last modified field
◆ atomDate()
| atomDate |
( |
| $date, |
|
|
| $atom ) |
Return a single component of given date according to format in dateFormat date example with hour: 03/05/2003 23:43:00 (use only ':' as time separator) @access public
- Retorna
- date
- Parâmetros
-
| date | to extract atom from |
| atom | ->
- 'm' for return month;
- 'd' for return day;
- 'y' for return last two number of year
- 'Y' for return entire year
- 'h' for hours
- 'i' for minutes
- 's' for seconds
|
◆ Between()
| Between |
( |
| $date1, |
|
|
| $date, |
|
|
| $date2 ) |
◆ CompareDate()
| CompareDate |
( |
| $dateA, |
|
|
| $operator, |
|
|
| $dateB ) |
◆ dateToTimestamp()
Trasform a classical date format in unix timestamp format.
- date according to dateFormat and timeFormat parameter passed on inizialization
- Remember that unix timestamp is the amount of seconds since 1/1/1970 @access public
- Parâmetros
-
| date | $date | The date to transform |
- Retorna
- timestamp The date transformed in timestamp
◆ daysDiff()
| daysDiff |
( |
| $data_ini, |
|
|
| $data_fin ) |
Define what's the day difference between two given date.
- date according to dateFormat parameter passed on inizialization @access public
- Parâmetros
-
| date | $data_ini | The start date |
| date | $data_fin | The end date |
- Retorna
- int The difference in days between the two given dates
◆ dayToN()
Convert the name of a day in its numerical value.
- i.e.: Monday stay for 0, Saturday stay for 6 @access public
- Parâmetros
-
| string | $day | The name of day, short or long. |
- Retorna
- int the number of day
◆ exitOnError()
Function that exit with the error message if given @access private
- Retorna
- void
◆ GetDay()
◆ getInfo()
| getInfo |
( |
| $date, |
|
|
| $what, |
|
|
| $format = "short" ) |
Function that give some information on a date
- in according with dateFormat @access public
- Parâmetros
-
| string | $date | The date to extract info |
| string | $what | What info to extract from date given (in any case)
- "monthname" give the name of month
- "dayname" give the name of day
- "dayofweek" give the ordinal number of day in the week (1 for Sunday, 1 for Monday, and so on)
- "dayofyear" give the ordinal number of day in the year
- "week" give the number of week in the year
- "trimester" give the number of trimester in the year
|
| string | $format | For textual information, specify if out in the short or long format +"short" or "s" for the short format (default) +"long" or "l" for the long format |
- Retorna
- string The information asked
◆ getLastDayOfMonth()
| getLastDayOfMonth |
( |
| $month, |
|
|
| $year = NULL ) |
◆ GetMonth()
◆ getMonthByNumber()
| getMonthByNumber |
( |
| $number | ) |
|
◆ getNthDay()
| getNthDay |
( |
| $number, |
|
|
| $weekday, |
|
|
| $month, |
|
|
| $year = 0 ) |
Get the date of Nth day of the month ..
- example: what is the date of the 2nd Sunday of April 2003 ???
@access public - Retorna
- date The date
- Parâmetros
-
| int | $number | The ordinal value to get date |
| string | $weekday | The name of day given in Long or short format |
| mixed | $month | the name or number of month |
| int | $year | the year number |
◆ getSunTime()
| getSunTime |
( |
| $latitude = 0, |
|
|
| $longitude = 0, |
|
|
| $timezone = 1, |
|
|
| $location = 'IT|Roma', |
|
|
| $daylight = 1, |
|
|
| $date = '' ) |
Return the sunset or sunrise for the given date and geo location.
- note: the method called without parameter return the sunrise and sunset of Rome (Italy) with daylight actived @access public
- Retorna
- string
- Parâmetros
-
| int | $latitude | Stay for latitude |
| int | $longitude | Stay for longitude |
| int | $timezone | Is the timezone referred to GMT
- (ie: for Italy is 1, for Spain is -1 and so on)
|
| string | $location | If don't know the geographical coordinates of your city give the name of location. (Support only Italian cities) |
| int | $daylight |
- '1' or 'on' if the location use daylight saving time
- '0' or 'off' if the location doesn't use daylight saving time
|
| string | $date | The date to calc sunset/sunrise on |
◆ GetYear()
◆ howDays()
| howDays |
( |
| $data_ini, |
|
|
| $data_fin, |
|
|
| $day ) |
Define how many days (give it in name format) are in period given.
- i.e.: How friday are from Nov,1 2002 to Mar,23 2003 ? @access public
- Parâmetros
-
| date | $data_ini | The start date |
| date | $data_fin | The end date |
| string | $day | The name of day for calculating on |
- Retorna
- int The number of day in the period given
◆ howTo()
Define how days left to given date. date according to dateFormat parameter passed on inizialization @access public
- Parâmetros
-
| date | $data | The date in traditional format for calculating diff |
- Retorna
- int The amount of days between today and given date
◆ InvertDate()
◆ isDay()
Define if the day of date given is equal to day given.
- Is Friday the 22nd of November 2002 ?
- date according to dateFormat parameter passed on inizialization @access public
- Parâmetros
-
| date | $data | The date to check |
| string | $day | The name of day to check |
- Retorna
- mixed 1 if check is true, otherwise the day of date
◆ isValid()
Function that check the validity of a date and/or time
◆ kDate()
| kDate |
( |
| $format = "%l %d %F %Y", |
|
|
| $timestamp = 0 ) |
Date like function. Using the same format functionality @access public
- Retorna
- string The date according with format given
- Parâmetros
-
| string | format ->
- valid format parameter:
- l (L lowercase): Day textual long
- d: Day of month, 2 digits with leading zeros
- F: Month textual Long
- Y: Year, 4 digits
- y: Year, 2 digits
- m: Month numeric, 2 digits with leading zeros
- D: Day textual short
- M: Month textual short
- n: Month numeric, without leading zeros
- j: Day of month, without leading zeros
|
| timestamp | $timestamp | The time to transform |
◆ kMkTime()
Work like php native mktime() but with date accordingly to format used @access private
- Parâmetros
-
| array | $exp | The date to transform |
- Retorna
- timestamp The timestamp calculated on date given
◆ makeTime()
◆ monthsDiff()
| monthsDiff |
( |
| $data_ini, |
|
|
| $data_fin ) |
Define what's the month difference between two given date.
- date according to dateFormat parameter passed on inizialization @access public
- Parâmetros
-
| date | $data_ini | The start date |
| date | $data_fin | The end date |
- Retorna
- int The difference in months between the two given dates
◆ monthToN()
Convert the name of a month in its numerical value.
- i.e.: February stay for 2, December stay for 12 @access public
- Parâmetros
-
| string | $month | The name of month, short or long format, in language setted by constructor |
- Retorna
- int The number rappresenting the month
◆ mysql_time_easy()
| mysql_time_easy |
( |
| $timestamp, |
|
|
| $mode = 'mysqlfrom' ) |
Transform a MySQL like timestamp to a readable format (and viceversa)
- ie: 20011210002745 -> December 10, 2001, 12:27 am @access public
- Retorna
- string The timestamp or the date in readable format
- Parâmetros
-
| timestamp | $timestamp | The mysql timestamp or date |
| string | $mode | mysqlfrom (convert mysql timestamp to readable format) |
| string | $mode | mysqlto (convert a date in readable format to mysql timestamp) |
◆ netTimestamp()
| netTimestamp |
( |
| $server = 'time-a.nist.gov', |
|
|
| $port = 37 ) |
Return the timestamp from a NIST TIME SERVER on the net. Get the atomic time!
- attention
- have to stay on line for work!! @access public
- Retorna
- timestamp The timestamp from internet
◆ NToDay()
Convert the numerical value of a day in its name for the setted language by constructor.
- Short o long format is choosed by setting the abbr value to true o false @access public
- Parâmetros
-
| int | $day | The number of day, 0 stay for Sunday and 6 for Saturday |
- Retorna
- string the name of day in language setted by constructor
◆ NToMonth()
Convert the numerical value of a month in its name.
- Short o long format is choosed by setting the abbr value to true o false @access public
- Parâmetros
-
| string | $month | The number of month |
- Retorna
- string The name of month in language setted by constructor
◆ operation()
| operation |
( |
| $operator, |
|
|
| $date, |
|
|
| $operand ) |
◆ pg_time_easy()
| pg_time_easy |
( |
| $timestamp | ) |
|
◆ romanDate()
Return the date in ancient roman date format
- note: the date is output in the form: ddmmyyyy without separator.Support maximum to 5000 years!!! @access public
- Retorna
- string The date in roman format
- Parâmetros
-
| date | $date | The date to transform |
◆ secsToTime()
Function to turn seconds into a time
◆ swatchTime()
Returns the current time in swatch .beat format. Remember that 1000 beats = 24 hours @access public
- Retorna
- string The swatch beat time
◆ timesAdd()
| timesAdd |
( |
| $time, |
|
|
| $add, |
|
|
| $what ) |
Add some minutes or hours to a given time.
- i.e.: (add 2 hours to 14.10 -> result is 16.10)
- Accept only 24H format.
- the time is a string like: "4.50" or "4:50"
- Parâmetros
-
| string | $time | The time string to transform |
| int | $add | The hours or minutes to add |
| char | $what | is what add to time |
- "m" -> for add minutes
- "h" -> for add hours
- "t" -> for add time string given in HH:mm format
- Retorna
- string Result is in format HH:mm, return -1 on error
◆ timesDiff()
| timesDiff |
( |
| $time_from, |
|
|
| $time_to, |
|
|
| $result_in = "m" ) |
Give the difference between two times.
- (i.e.: how minutes from 4.50 to 12.50?).
- Accept only 24H format.
- the time is a string like: "4.50" or "4:50" @access public
- Parâmetros
-
| string | $time_from | The start time |
| string | $time_to | The end time |
| char | $result_in | The format of result |
- "m" -> for minutes
- "s" -> for seconds
- "h" -> for hours
- Retorna
- string The difference between times according to format given in $result_in
◆ timeToText()
| timeToText |
( |
| $seconds, |
|
|
| $format = "h" ) |
Return the literal value of a unix timestamp or seconds
- i.e.: so 3670 seconds mean 1 hour, 1 minute and 10 seconds.
- Parâmetros
-
| int | $seconds | Number of seconds to transform. |
| char | $format | The format of output, +"h" for hours.minutes.seconds (short form) +"d" for year.months.days.etc (short form) +"H" for hours.minutes.seconds (long form) +"D" for year.months.days.etc (long form) @access public |
- Retorna
- string The seconds transformed in text
◆ todayMoonPhase()
| todayMoonPhase |
( |
| $date = '' | ) |
|
◆ weeksDiff()
| weeksDiff |
( |
| $data_ini, |
|
|
| $data_fin ) |
Define what's the week difference between two given date.
- date according to dateFormat parameter passed on inizialization @access public
- Parâmetros
-
| date | $data_ini | The start date |
| date | $data_fin | The end date |
- Retorna
- int The difference in weeks between the two given dates
◆ yearMoonPhases()
Returns an array with all the phases of the moon for a whole year @access public
- Parâmetros
-
| int | $Y | is the year to get moon phases. |
- Retorna
- array The moonphase for each day
◆ yearsDiff()
| yearsDiff |
( |
| $data_ini, |
|
|
| $data_fin ) |
Define what's the year difference between two given date.
- date according to dateFormat parameter passed on inizialization @access public
- Parâmetros
-
| date | $data_ini | The start date |
| date | $data_fin | The end date |
- Retorna
- int The difference in years between the two given dates
◆ $abbr
Variable for choose long or short day names format @access public
◆ $dataFrom
General purpose use @access private
◆ $dataTo
General purpose use @access private
◆ $dateFormat
Set to desidered date format @access public
- possible values:
- it -> italian (dd-mm-yyyy)
- en,std -> international (mm-dd-yyyy)
- ansi -> used in dbase and other source (yyyy-mm-dd)
◆ $dayNameCon
Array that contain the name of days in short format @access private
◆ $dayNameExt
Array that contain the name of days in long format * @access private
◆ $error
Used for errors @access private
◆ $lan
Set to desidered language @access public
◆ $monthNameCon
Array that contain the name of month in short format @access private
◆ $monthNameExt
Array that contain the name of month in long format @access private
◆ $months
Valor inicial:= array(
'01' => 'Janeiro',
'02' => 'Fevereiro',
'03' => 'Março',
'04' => 'Abril',
'05' => 'Maio',
'06' => 'Junho',
'07' => 'Julho',
'08' => 'Agosto',
'09' => 'Setembro',
'10' => 'Outubro',
'11' => 'Novembro',
'12' => 'Dezembro',
)
Array for Months @access public
◆ $path
Char for path of ini files @access public
◆ $separator
Char for separating date @access public
◆ $timeFormat
Set to desidered time format @access public
- possible values:
- 24,it -> italian format 24H ie: 20.17, 9.11
- 12,en -> international 12H ie: 8.17PM, 9.11AM
◆ $version
Version number @access private
A documentação para esta classe foi gerada a partir do seguinte ficheiro:
- /var/docker/solisge-devel/www/solisge/miolo25/classes/utils/mkrono.class.php