Changeset 5229


Ignore:
Timestamp:
Mar 21, 2010, 9:48:21 PM (11 years ago)
Author:
grum
Message:

fix bug when formating dates : invalid dates are now ignored

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/JpegMetaData/Common/ConvertData.class.php

    r4972 r5229  
    288288    static public function toDateTime($dateTime)
    289289    {
    290       if(preg_match('/^(\d{4}:\d{2}:\d{2}\s\d{2}:\d{2}(:\d{2}){0,1}\x00{0,1}|\d{4}-\d{2}-\d{2}(T|\s)\d{2}:\d{2}(:\d{2}){0,1}(Z|[+|-]\d{2}:\d{2}){0,1}|\d{4}\d{2}\d{2})/', $dateTime))
     290      if(preg_match('/^('.
     291           '\d{4}:\d{2}:\d{2}\s\d{2}:\d{2}(:\d{2}){0,1}\x00{0,1}|'.
     292           '\d{4}-\d{2}-\d{2}(T|\s)\d{2}:\d{2}(:\d{2}){0,1}(Z|[+|-]\d{2}:\d{2}){0,1}|'.
     293           '\d{4}\d{2}\d{2}'.
     294           ')$/', $dateTime))
    291295      {
    292296        $returned=new DateTime($dateTime, new DateTimeZone("UTC"));
Note: See TracChangeset for help on using the changeset viewer.