method datetime()
Synopsis
$now = new datetime("current");
$now = new datetime(time());
$date = new datetime("2005-12-31", "Europe/Zurich");
$time = new datetime("13:45:21", "Europe/Zurich");
$datetime = new datetime("31.12.2005 13:45", , "Europe/Zurich", "de");
$datetime = new datetime(array('day' => 31, 'month' => 12, 'year' => 2005, 'hour' => 13, 'minute' => 45), "Europe/Zurich");
Return
VOID Creates a new Object
Arguments
Argument | Type | Default | Description |
$datetime | MIXED | | the datetime to create the new object from. Can be either an array with the keys ('day', 'month', 'year') or ('week','dayofweek','year') for date and/or ('hour','minute','second') for time.
For missing date-parts the default value is current-date (e.g. if you ommit year the current year will be taken).
For missing time-parts the default value is 0 (e.g. if you ommit the seconds it will be set to 0).
|
$timezoneID | STRING | | Either one of the timezone-id's like America/Los_Angeles (see data.locations.tab) or use a utc-name 'UTC±difference' like 'UTC', 'UTC+1' or 'UTC-4'. Timezone-IDs are prefered since they can determine the whished language, DST-behaviour and geographic position as well.
|
$language | STRING | | An ISO 3166 two-letter-countrycode (like 'en', 'de' or 'fr'). The language parameter will override the setting retrieved from a timezone-ID. This can be useful if you want to print a date from another country but in your language.
|
Description
Creates a new date/time object from $datetime using create_fromString (if $datetime is a string), create_fromUnixtime (if $datetime is an integer) or create_fromArray (if $datetime is an array).
method create_fromString()
Synopsis
$result = $datetime->create_fromString('1/1/2005 13.45', false);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$string | STRING | | A string containing a date and/or time in any format known in the loaded language files
|
$croak | BOOL | | If $croak is true the function will trigger an error if it can not match the string or if the recognized date is corrupt.
Set this to false if you want to parse e.g. formular input where it is not sure that a date/time can be matched.
|
Description
Sets the date/time from a human- or machine-readable string. Useful for date/time fields in forms.
method create_fromUnixtime()
Synopsis
$result = $datetime->create_fromUnixtime(1108500000);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$unixtime | INT | | The unixtimestamp from which you want to create a datetime-object.
|
Description
Set the date/time from a unixtimestamp.
method create_fromMySQL()
Synopsis
$result = $datetime->create_fromMySQL('2005-01-20 12:00:00');
$result = $datetime->create_fromMySQL('20050120120000');
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$integer | STRING | | A MySQL datetime stamp in either the integer-format (yyyymmddHHMMSS) or string-format ('yyyy-mm-dd HH:MM:SS').
|
Description
Set the date/time from a MYSQL-datetime or -timestamp field.
method create_fromCurrent()
Synopsis
$result = $datetime->create_fromCurrent();
Return
BOOL Success
Description
Sets date and time to current date and time.
method create_fromArray()
Synopsis
$result = create_fromArray(array('year' => 2005, 'month' => 1, 'day' => 20, 'hour' => 12, 'minute' => 59, 'second' => 2);
$result = create_fromArray(array('month' => 1, 'day' => 20, 'hour' => 12);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$array | ARRAY | | The components of date/time, can use the keys: year, month, day, hour, minute, second, timezone
If no date-part is supplied a time-object is created.
If no time-part is supplied a date-object is created.
If at least one date-part is supplied, the default for omitted date-parts is the current date (e.g. you ommit the year, then the current year will be taken)
If at least one time-part is supplied, the default for omitted time-parts is 0.
|
Description
Set time/date from an array containing the parts.
We make an educated guess what defaults to take. Idea is following:
-if a datepart is supplied we fill in gaps with current date (e.g. month and day are supplied we complement year with current year)
-if a timepart is supplied we fill in gaps with 0
-timezone: argument > creation-supplied > default (means: if given in the array, that value will be taken, else it falls back to the timezone given at creation or in worst case uses default)
method set_micro()
Synopsis
$result = $datetime->set_micro(456);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$micro | INT | | Set the microseconds-part of a datetime-object to $micro
|
Description
Set the microseconds-part of the time
Date-Objects will automatically become datetime-object if this method is used.
method set_milli()
Synopsis
$result = $datetime->set_milli(123);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$milli | INT | | Set the milliseconds-part of a datetime-object to $milli
|
Description
Set the milliseconds-part of the time
Date-Objects will automatically become datetime-object if this method is used.
method set_second()
Synopsis
$result = $datetime->set_second(52);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$second | INT | | Set the seconds-part of a datetime-object to $second
|
Description
Set the seconds-part of the time
Date-Objects will automatically become datetime-object if this method is used.
method set_minute()
Synopsis
$result = $datetime->set_minute(45);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$minute | INT | | Set the minutes-part of a datetime-object to $minute
|
Description
Set the minutes-part of the time
Date-Objects will automatically become datetime-object if this method is used.
method set_hour()
Synopsis
$result = $datetime->set_hour(13);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$hour | INT | | Set the hours-part of a datetime-object to $hour
|
Description
Set the hours-part of the time
Date-Objects will automatically become datetime-object if this method is used.
method set_day()
Synopsis
$result = $datetime->set_day(21);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$day | INT | | The day of the year to which the date should be set. It will become converted to the according month and day of month.
|
$month | INT | | The month of which the day is set. If set to false, get_month() is used.
You should NOT use this argument, it is only for internal purposes.
|
$year | INT | | The year of which the day is set. If set to false, get_year() is used.
You should NOT use this argument, it is only for internal purposes.
|
Description
Set the day of the month to $day.
method set_dayOfYear()
Synopsis
$result = $datetime->set_dayOfYear(121);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$dayOfYear | INT | | The day of the year to which the date should be set. It will become converted to the according month and day of month.
|
$year | INT | | The year of which the day-of-year is set. If set to false, get_year() is used.
You should NOT use this argument, it is only for internal purposes.
|
Description
Set the date (day-of-month and month) to a specific day of the year.
method set_month()
Synopsis
$result = $datetime->set_month(1);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$month | INT | | The month to which the date should be set.
|
Description
Set the month to $month.
method set_year()
Synopsis
$result = $datetime->set_year($year);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$year | INT | | The year to which the date should be set.
|
Description
Set the year to $year.
method setTo_nthDayOfWeek()
Synopsis
$result = $datetime->setTo_nthDayOfWeek(0);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th day of week, time is preserved
If $n is negative date is set to the {$n}th-last day of week
|
Description
Set the date to a specific weekday of the current week.
method setTo_nthDayOfMonth()
Synopsis
$result = $datetime->setTo_nthDayOfMonth(-1);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th day of month, time is preserved
If $n is negative date is set to the {$n}th-last day of month
|
Description
Set the date to a specific day of month.
method setTo_nthDayOfYear()
Synopsis
$result = $datetime->setTo_nthDayOfYear(-1);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th day of year, time is preserved
If $n is negative date is set to the {$n}th-last day of year
|
Description
Set the date to a specific day of the year.
method setTo_nthWeekOfYear()
Synopsis
$result = $datetime->setTo_nthWeekOfYear(1, false);
$result = $datetime->setTo_nthWeekOfYear(1, 0);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th week of year, time is preserved
|
$weekday | INT | | Date set to weekday $weekday (false for preserving current weekday)
|
Description
Set the date to a specific weekday of a specific week of the year.
method setTo_sunrise()
Synopsis
$result = $datetime->setTo_sunrise();
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$location | MIXED | | False (default) for using current timezone-ID's coordinates
A location object
A coordinates-array in form: array([FLOAT]latitude, [FLOAT]longitude)
A string containing a valid timezoneID
|
Description
Changes time of datetime object to the time of sunrise in location $location
method setTo_sunset()
Synopsis
$result = $datetime->setTo_sunset($location);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$location | MIXED | | False (default) for using current timezone-ID's coordinates
A location object
A coordinates-array in form: array([FLOAT]latitude, [FLOAT]longitude)
A string containing a valid timezoneID
|
Description
Changes time of datetime object to the time of sunset in location $location
method setTo_morningTwilight()
Synopsis
$result = $datetime->setTo_morningTwilight($location);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$location | MIXED | | False (default) for using current timezone-ID's coordinates
A location object
A coordinates-array in form: array([FLOAT]latitude, [FLOAT]longitude)
A string containing a valid timezoneID
|
Description
Changes time of datetime object to the time of morning-twilight in location $location
method setTo_eveningTwilight()
Synopsis
$result = $datetime->setTo_eveningTwilight($location);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$location | MIXED | | False (default) for using current timezone-ID's coordinates
A location object
A coordinates-array in form: array([FLOAT]latitude, [FLOAT]longitude)
A string containing a valid timezoneID
|
Description
Changes time of datetime object to the time of evening-twilight in location $location
method do_add()
Synopsis
$result = $datetime->do_add($differenceOrArray);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$differenceOrArray | MIXED | | Difference-Object or array with one or more of the keys 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years'
|
Description
Adds a datetime-difference (any combination of seconds, minutes, hours, days, weeks, months and years) to the datetime.
method do_addSeconds()
Synopsis
$result = $datetime->do_addSeconds($seconds);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$seconds | INT | | Amount of seconds to add
|
Description
Adds $seconds seconds to the datetime.
method do_addMinutes()
Synopsis
$result = $datetime->do_addMinutes($minutes);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$minutes | INT | | Amount of minutes to add
|
Description
Adds $seconds seconds to the datetime.
method do_addHours()
Synopsis
$result = $datetime->do_addHours($hours);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$hours | INT | | Amount of seconds to add
|
Description
Adds $hours hours to the datetime.
method do_addDays()
Synopsis
$result = $datetime->do_addDays($days);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$days | INT | | Amount of days to add
|
Description
Adds $days days to the datetime.
method do_addMonths()
Synopsis
$result = $datetime->do_addMonths($months, $cutOverflow);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$months | INT | | Amount of months to add
|
$cutOverflow | BOOL | | If overflow days should be added or just cut
|
Description
Adds $monts monts to the datetime.
If cutOverflow is false, then 31.3. +1month is eqal 1.5. Else it is equal 30.4. (since there is no 31.4.).
method do_addYears()
Synopsis
$result = $datetime->do_addYears($years);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$years | INT | | Amount of years to add
|
Description
Adds $years years to the datetime.
method do_subtractDatetime()
Synopsis
$result = $datetime->do_subtractDatetime($subtrahend);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$subtrahend | OBJECT | | Datetime-Object to subtract from $this
|
Description
Subtracts a datetime from the datetime.
This operation changes the object-type to a difference-object.
You can use datetime->do_subtract() instead.
method do_subtract()
Synopsis
$result = $datetime->do_subtract($differenceDatetimeOrArray);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$differenceDatetimeOrArray | MIXED | | Difference-, Datetime-Object or array with one or more of the keys 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years'
|
Description
Subtracts a datetime or a datetime-difference (any combination of seconds, minutes, hours, days, weeks, months and years) from the datetime.
If you subtract a datetime the object-type will be changed to a difference-object.
method do_subtractSeconds()
Synopsis
$result = $datetime->do_subtractSeconds($seconds);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$seconds | INT | | Amount of seconds to subtract
|
Description
Subtracts $seconds seconds from the datetime.
method do_subtractMinutes()
Synopsis
$result = $datetime->do_subtractMinutes($minutes);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$minutes | INT | | Amount of minutes to subtract
|
Description
Subtracts $minutes minutes from the datetime.
method do_subtractHours()
Synopsis
$result = $datetime->do_subtractHours($hours);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$hours | INT | | Amount of hours to subtract
|
Description
Subtracts $hours hours from the datetime.
method do_subtractDays()
Synopsis
$result = $datetime->do_subtractDays($days);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$days | INT | | Amount of days to subtract
|
Description
Subtracts $days days from the datetime.
method do_subtractMonths()
Synopsis
$result = $datetime->do_subtractMonths($months, $cutOverflow);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$years | INT | | Amount of years to subtract
|
$cutOverflow | BOOL | | If overflow days should be added or just cut
|
Description
Subtracts $years years from the datetime.
If cutOverflow is false, then 31.3. +1month is eqal 1.5. Else it is equal 30.4. (since there is no 31.4.).
method do_subtractYears()
Synopsis
$result = $datetime->do_subtractYears($years);
Return
BOOL Success
Arguments
Argument | Type | Default | Description |
$years | INT | | Amount of years to subtract
|
Description
Subtracts $years years from the datetime.
method get_nthDayOfWeek()
Synopsis
$result = $datetime->get_nthDayOfWeek($n);
Return
OBJECT The datetime-object set to the n. day of the week
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th day of week, time is preserved
If $n is negative date is set to the {$n}th-last day of week
|
Description
Return a new datetime object with the date set to a specific weekday of the current week.
method get_nthDayOfMonth()
Synopsis
$result = $datetime->get_nthDayOfMonth($n);
Return
OBJECT The datetime-object set to the n. day of the month
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th day of month, time is preserved
If $n is negative date is set to the {$n}th-last day of month
|
Description
Return a new datetime object with the date set to a specific day of month.
method get_nthDayOfYear()
Synopsis
$result = $datetime->get_nthDayOfYear($n);
Return
OBJECT The datetime-object set to the n. day of the year
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th day of year, time is preserved
If $n is negative date is set to the {$n}th-last day of year
|
Description
Return a new datetime object with the date set to a specific day of the year.
method get_nthWeekOfYear()
Synopsis
$result = $datetime->get_nthWeekOfYear($n, $weekday);
Return
OBJECT The datetime-object set to a specific weekday of the n. week of the year
Arguments
Argument | Type | Default | Description |
$n | INT | | Date set to {$n}th week of year, time is preserved
|
$weekday | INT | | Date set to weekday $weekday (false for preserving current weekday)
|
Description
Return a new datetime object with the date set to a specific weekday of a specific week of the year.
method get_dayOfWeek()
Synopsis
$result = $datetime->get_dayOfWeek($format);
Return
MIXED Returns the day of week in a form depending on $format. Numeric values range from 0-6, where 0 represents the start of the week (monday).
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the day-of-week is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the day of the week
-'integer': will return the day of the week as integer
-'string': will look up the weekdays name in the active language file
|
Description
Return the weekday either as integer, padded-integer or localized string.
method get_dayOfMonth()
Synopsis
$result = $datetime->get_dayOfMonth($format);
Return
MIXED Returns the day of month in a form depending on $format. Numeric values range from 1-31.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the day-of-month is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the day of the month
-'integer': will return the day of the month as integer
|
Description
Return the day of month either as integer or as padded-integer.
method get_dayOfYear()
Synopsis
$result = $datetime->get_dayOfYear($format);
Return
MIXED Returns the day of year in a form depending on $format. Numeric values range from 1-366.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the day-of-year is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the day of the year
-'integer': will return the day of the year as integer
|
Description
Return the day of month either as integer or as padded-integer.
method get_daysOfMonth()
Synopsis
$result = $datetime->get_daysOfMonth($month, $year);
Return
INT Amount of days of month $month of year $year.
Arguments
Argument | Type | Default | Description |
$month | INT | | Month of which you want to know the amount of days. Uses $this->get_month() if set to false.
|
$year | INT | | Year in which the month is (only important for february). Uses $this->get_year() if set to false.
|
Description
Returns the amount of days of month $month of year $year.
method get_weeksOfYear()
Synopsis
$result = $datetime->get_weeksOfYear($year);
Return
INT Amount of weeks (52-53) year $year has.
Arguments
Argument | Type | Default | Description |
$year | INT | | Year of which to return amount of weeks. Uses $this->get_year() if set to false.
|
Description
Returns the amount of weeks year $year has.
method get_monthFromYearday()
Synopsis
$result = $datetime->get_monthFromYearday($day, $year);
Return
INT The month (1-12) in which the day-of-year $day is.
Arguments
Argument | Type | Default | Description |
$day | INT | | Day of year from which you want to know in which month it is.
|
$year | INT | | Year in which the month is. Uses $this->get_year() if set to false.
|
Description
Returns the month (1-12) in which the day-of-year $day is.
method get_monthDayFromYearday()
Synopsis
$result = $datetime->get_monthDayFromYearday($day, $year);
Return
INT Day of month (1-31) which the day of year corresponds to.
Arguments
Argument | Type | Default | Description |
$day | INT | | Day of year (1-365, 366 in leapyears).
|
$year | INT | | Year in which the month is (only important for february). Uses $this->get_year() if set to false.
|
Description
Returns the day of month (1-31) which the day of year corresponds to.
method get_date()
Synopsis
$result = $datetime->get_date();
Return
ARRAY Dump of the date-part of the object
Description
Returns a dump of the date-part of the object.
method get_time()
Synopsis
$result = $datetime->get_time();
Return
ARRAY Dump of the time-part of the object
Description
Returns a dump of the date-part of the object
method get_datetime()
Synopsis
$result = $datetime->get_datetime();
Return
ARRAY Dump of the date & time-part of the object
Description
Returns a dump of the date & time-part of the object
method get_year()
Synopsis
$result = $datetime->get_year($digits, $asInt);
Return
STRING Year of datetime
Arguments
Argument | Type | Default | Description |
$digits | INT | | How many digits of the year to return (2 and 4 are common)
|
$asInt | BOOL | | Return the year as integer rather then as string
|
Description
Returns the year of datetime.
method get_month()
Synopsis
$result = $datetime->get_month($format);
Return
MIXED The month in a form depending on $format. Numeric values range from 1-12.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the month is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the month
-'integer': will return the month as integer
-'string': will look up the months name in the active language file
|
Description
Return the month either as integer, padded-integer or localized string. Numeric values range from 1-12.
method get_day()
Synopsis
$result = $datetime->get_day($format);
Return
MIXED Returns the day of month in a form depending on $format. Numeric values range from 1-31.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the day-of-month is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the day of the month
-'integer': will return the day of the month as integer
|
Description
Return the day of month either as integer or as padded-integer.
method get_hour()
Synopsis
$result = $datetime->get_hour($format, $mode);
Return
MIXED Hour either as integer or padded-integer. Numeric values range from 1-12 or 1-24 (see $mode).
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the hour is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the hour
-'integer': will return the hour as integer
|
$mode | INT | | Valid values are 12 and 24. Defines if the hour is returned as value 1-12 or as value 1-24.
|
Description
Returns the hour either as integer or padded-integer. Numeric values range from 1-12 or 1-24 (see $mode).
method get_minute()
Synopsis
$result = $datetime->get_minute($format);
Return
MIXED Returns the minute in a form depending on $format. Numeric values range from 0-59.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the minute is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the minute
-'integer': will return the minute as integer
|
Description
Return the minute either as integer or as padded-integer.
method get_second()
Synopsis
$result = $datetime->get_second($format);
Return
MIXED Returns the second in a form depending on $format. Numeric values range from 0-59.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the second is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the second
-'integer': will return the second as integer
|
Description
Return the second either as integer or as padded-integer.
method get_milli()
Synopsis
$result = $datetime->get_milli($format);
Return
MIXED Returns the millisecond in a form depending on $format. Numeric values range from 0-999.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the millisecond is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the millisecond
-'integer': will return the millisecond as integer
|
Description
Return the millisecond either as integer or as padded-integer.
method get_micro()
Synopsis
$result = $datetime->get_micro($format);
Return
MIXED Returns the microsecond in a form depending on $format. Numeric values range from 0-999.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the microsecond is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the microsecond
-'integer': will return the microsecond as integer
|
Description
Return the microsecond either as integer or as padded-integer.
method get_week()
Synopsis
$result = $datetime->get_week($format);
Return
MIXED The week in a form depending on $format. Numeric values range from 1-53.
Arguments
Argument | Type | Default | Description |
$format | STRING | | Specifies in what format the week is returned. Valid are following values:
-'alldigits': will return a padded number corresponding to the week
-'integer': will return the week as integer
|
Description
Return the week either as integer or as padded-integer.
method get_zodiac()
Synopsis
$result = $datetime->get_zodiac();
Return
STRING localized name of the zodiac
Description
Returns the localized name of the zodiac for the datetime.
method get_age()
Synopsis
$result = $datetime->get_age();
Return
INT The difference of total years between datetime and today.
Description
Returns the difference of total years between datetime and today.
Useful for usermanagements where you want to extract the age of somebody e.g.
method as_array()
Synopsis
$result = $datetime->as_array();
Return
ARRAY An array containing all relevant values of datetime.
Description
Returns an array containing all relevant values of datetime.
method as_unixtime()
Synopsis
$result = $datetime->as_unixtime();
Return
INT A unixtimestamp representation of datetime
Description
Returns a unixtimestamp representation of datetime
method as_mysqlDate()
Synopsis
$result = $datetime->as_mysqlDate();
Return
STRING A string-representation of date-part of datetime ready for mysql-queries
Arguments
Argument | Type | Default | Description |
$asInteger | BOOL | | Return the value in the mysql-integer format for dates (yyyymmdd).
|
Description
Returns a string-representation of date-part of datetime ready for mysql-queries
method as_mysqlTime()
Synopsis
$result = $datetime->as_mysqlTime($asInteger);
Return
STRING A string-representation of date-part of datetime ready for mysql-queries
Arguments
Argument | Type | Default | Description |
$asInteger | BOOL | | Return the value in the mysql-integer format for dates (HHMMSS).
|
Description
Returns a string-representation of date-part of datetime ready for mysql-queries
method as_mysqlDatetime()
Synopsis
$result = $datetime->as_mysqlDatetime($asInteger);
Return
STRING A string-representation of datetime ready for mysql-queries
Arguments
Argument | Type | Default | Description |
$asInteger | BOOL | | Return the value in the mysql-integer format for dates (yyyymmddHHMMSS).
|
Description
Returns a string-representation of datetime ready for mysql-queries
method as_string()
Synopsis
$datetime = new datetime();
echo $datetime->as_string("%m/%d/%Y %H.%M");
--> 11/21/2005 13.45
echo $datetime->as_string("%B %{B|lc} %{monthname|uc|3}");
--> November november NOV
Return
STRING The string containing the values as given in $pattern
Arguments
Argument | Type | Default | Description |
$pattern | STRING | | How the string should be formatted, allowed are the two formats %<char>, %{string|modifier|...}.
See @chronos::get_stringPart() and @chronos::get_appliedModificators() for more informations about the formatting.
|
Description
Returns a formatted string of the datetime, comparable to strftime for unix-timestamps.
Be aware that the advanced syntax (%{part|modifier|...}) is quite powerful.