ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:datetime:adodb_date2

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
Next revisionBoth sides next revision
datetime:adodb_date2 [2015/11/26 15:24] mnewnhamv5:datetime:adodb_date2 [2016/01/13 02:12] – ↷ Page moved from datetime:adodb_date2 to v5:datetime:adodb_date2 mnewnham
Line 11: Line 11:
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-This function extends the adodb_date() function, allowing the second argument to be passed as an ISO format string instead of a timestamp.+This function extends the adodb_date() function, allowing the second argument to be passed as an ISO format string instead of a timestamp. This makes it easier to generate formatted times outside of the normal unix timestamp range
 ---------------------------------- ----------------------------------
 ===== Usage ===== ===== Usage =====
Line 17: Line 17:
 $d = adodb_date2('d-M-Y H:i','1520-12-25 13:01:34'); $d = adodb_date2('d-M-Y H:i','1520-12-25 13:01:34');
 </code> </code>
 +===== Note =====
 +
 +To make the calculation work correctly for early years, it is important to use 4 digit years for the ''$isoDateString''
 +-----------------------------------------------
 +<code php>
 +/*
 +* Correct usage
 +*/
 +$date = adodb_date('m/d/Y', '0900-12-31 13:01:34')
 +/*
 +* Returns 12/25/900
 +*/
 +
 +/*
 +* Incorrect usage
 +*/
 +$date = adodb_date('m/d/Y', '900-12-31 13:01:34')
 +/*
 +* Returns 12/03/2015 (todays date)
 +*/
 +</code>
 +
v5/datetime/adodb_date2.txt · Last modified: 2023/05/18 18:54 by dregad