Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Error in Dates


Recommended Posts

When entering the DOB for a client as 21/02/1969, the resulting DOB placed in the database is 31/12/1969.


When looking at this code on general.php I see that provisions have been made to solve this issue, however they don't work completely:


// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers
 function tep_date_short($raw_date) {
   if ( ($raw_date == '0000-00-00 00:00:00') || empty($raw_date) ) return false;

   $year = substr($raw_date, 0, 4);
   $month = (int)substr($raw_date, 5, 2);
   $day = (int)substr($raw_date, 8, 2);
   $hour = (int)substr($raw_date, 11, 2);
   $minute = (int)substr($raw_date, 14, 2);
   $second = (int)substr($raw_date, 17, 2);

   if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {
     return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
   } else {
     return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));


We are not on a windows server, should this code be removed? Is there another problem causing this isssue? Thank you in advance for any suggestions.

Link to comment
Share on other sites

After further testing I have found that any date that ends with xx/xx/1969 results in 31/12/1969 being placed into the database.


Is no one else having this problem? Maybe when someone signs up for your carts and has a 1969 DOB more people will take notice? I guess I'll submit this as a bug...

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...