ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:datetime:adodb_date

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
datetime:adodb_date [2015/11/26 15:09] mnewnhamv5:datetime:adodb_date [2023/05/18 18:55] (current) – Deprecated dregad
Line 5: Line 5:
 [[http://php.net/manual/en/function.date.php|PHP Function date()]] [[http://php.net/manual/en/function.date.php|PHP Function date()]]
 == Syntax == == Syntax ==
-  int adodb_time()+  string adodb_date( 
 +      string $format, 
 +      optional mixed $timestamp = false 
 +  )
 </WRAP> </WRAP>
 +
 +<WRAP important>
 +[[datetime_index#deprecated|Deprecated]] since ADOdb 5.22.6, and [[https://github.com/ADOdb/ADOdb/issues/970|removed in 5.23.0]].
 +Use 64-bit native PHP functions instead.
 +</WRAP>
 +
 ===== Description ===== ===== Description =====
  
 +This function converts a timestamp to a formatted local date. If ''$timestamp'' is not defined, the current timestamp is used. Unlike the function date(), it supports dates outside the 1901 to 2038 range. To produce a date prior to the epoch date, a negative number of seconds prior to that number can be provided
 +-------------------------------------
 +===== Usage ======
 +<code php>
 +print adodb_date('d/m/Y');
 +/*
 +* Prints 03/12/2015
 +*/
 +
 +print adodb_date('d/m/Y',0);
 +/*
 +* Prints 12/31/1969
 +*/
 +
 +print adodb_date('d/m/Y', -27454896000);
 +/*
 +* Prints 12/21/1099
 +*/
 +</code>
 +===== Available Formats =====
 +The format fields that adodb_date supports:
 +
 +  a - "am" or "pm"
 +  A - "AM" or "PM"
 +  d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
 +  D - day of the week, textual, 3 letters; e.g. "Fri"
 +  F - month, textual, long; e.g. "January"
 +  g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
 +  G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
 +  h - hour, 12-hour format; i.e. "01" to "12"
 +  H - hour, 24-hour format; i.e. "00" to "23"
 +  i - minutes; i.e. "00" to "59"
 +  j - day of the month without leading zeros; i.e. "1" to "31"
 +  l - (lowercase 'L') - day of the week, textual, long; e.g. "Friday"
 +  L - boolean for whether it is a leap year; i.e. "0" or "1"
 +  m - month; i.e. "01" to "12"
 +  M - month, textual, 3 letters; e.g. "Jan"
 +  n - month without leading zeros; i.e. "1" to "12"
 +  O - Difference to Greenwich time in hours; e.g. "+0200"
 +  Q - Quarter, as in 1, 2, 3, 4
 +  r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200"
 +  s - seconds; i.e. "00" to "59"
 +  S - English ordinal suffix for the day of the month, 
 +      2 characters i.e. "st", "nd", "rd" or "th"
 +  t - number of days in the given month; i.e. "28" to "31"
 +  T - Timezone setting of this machine; e.g. "EST" or "MDT"
 +  U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
 +  w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
 +  Y - year, 4 digits; e.g. "1999"
 +  y - year, 2 digits; e.g. "99"
 +  z - day of the year; i.e. "0" to "365"
 +  Z - timezone offset in seconds (i.e. "-43200" to "43200").
 +      The offset for timezones west of UTC is always negative, 
 +      and for those east of UTC is always positive.
 +
 +The following formats are unsupported:
  
-Convert a timestamp to a formatted local date. If $timestamp is not defined, the current timestamp is used. Unlike the function date(), it supports dates outside the 1901 to 2038 range.The format fields that adodb_date supports: +  B - Swatch Internet time 
- a - "am" or "pm" +  (capital i) - "1" if Daylight Savings Time, "0" otherwise. 
- A - "AM" or "PM" +  W - ISO-8601 week number of year, weeks starting on Monday 
- d - day of the month, 2 digits with leading zeros; i.e. "01" to "31" +   
- D - day of the week, textual, 3 letters; e.g. "Fri" +  
- F - month, textual, long; e.g. "January" +
- g - hour, 12-hour format without leading zeros; i.e. "1" to "12" +
- G - hour, 24-hour format without leading zeros; i.e. "0" to "23" +
- h - hour, 12-hour format; i.e. "01" to "12" +
- H - hour, 24-hour format; i.e. "00" to "23" +
- i - minutes; i.e. "00" to "59" +
- j - day of the month without leading zeros; i.e. "1" to "31" +
- l (lowercase 'L') - day of the week, textual, long; e.g. "Friday" +
- L - boolean for whether it is a leap year; i.e. "0" or "1" +
- m - month; i.e. "01" to "12" +
- M - month, textual, 3 letters; e.g. "Jan" +
- n - month without leading zeros; i.e. "1" to "12" +
- O - Difference to Greenwich time in hours; e.g. "+0200" +
- Q - Quarter, as in 1, 2, 3, 4 +
- r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" +
- s - seconds; i.e. "00" to "59" +
- S - English ordinal suffix for the day of the month, 2 characters; +
-     i.e. "st", "nd", "rd" or "th" +
- t - number of days in the given month; i.e. "28" to "31" +
- T - Timezone setting of this machine; e.g. "EST" or "MDT" +
- U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) +
- w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) +
- Y - year, 4 digits; e.g. "1999" +
- y - year, 2 digits; e.g. "99" +
- z - day of the year; i.e. "0" to "365" +
- Z - timezone offset in seconds (i.e. "-43200" to "43200"). +
-     The offset for timezones west of UTC is always negative, +
- and for those east of UTC is always positive. +
-Unsupported: +
- B - Swatch Internet time +
- I (capital i) - "1" if Daylight Savings Time, "0" otherwise. +
- W - ISO-8601 week number of year, weeks starting on Monday+
v5/datetime/adodb_date.1448546991.txt.gz · Last modified: 2017/04/21 11:27 (external edit)