Hi!

I new here, and not speak english very well.

So, I have some problems using Zend_Date, i don't know
but year 2038 is not valid, i think some related to timestamp
limit or locate, or I not using Zend_Date correct way.

CODE:

//date_default_timezone_set ( 'America/New_York' );
//$locale  = new Zend_Locale( 'en_US' );
date_default_timezone_set ( 'America/Sao_Paulo' );
$locale  = new Zend_Locale( 'pt_BR' );

function isValidDate( $value, $locale  ) {
   if ( Zend_Date::isDate( $value, 'MM-dd-yyyy', $locale ) )  echo "$value: Is Valid 
<br/>";
   else echo "$value: Is NOT Valid <br/>";
}

isValidDate( '01-01-2008', $locale ); // Return 01-01-2008: Is Valid isValidDate( '01-01-2020', $locale ); // Return 01-01-2020: Is Valid isValidDate( '01-01-2037', $locale ); // Return 01-01-2037: Is Valid isValidDate( '01-01-2038', $locale ); // Return 01-01-2038: Is NOT Valid isValidDate( '01-01-2039', $locale ); // Return 01-01-2039: Is Valid isValidDate( '01-01-3000', $locale ); // Return 01-01-3000: Is Valid isValidDate( '01-01-0001', $locale ); // Return 01-01-0001: Is Valid
-----------

When I change locale and time zone to en_US:America/New_York, year 2038
become valid, I make tests changing format 'MM-dd-yyyy' to my reginal format 'dd-MM-yyyy', or switching 'y' to 'Y', and still get problem.

Another thing I want know, is there some option to make Zend_Date
not 'try' detect time zone from date string, this generate some warnings
because of @. I use error_handler to get errors, and when my application
go to production, normaly I set display_errors off, and send errors by email.

CODE:

$zDate = new Zend_Date('01.01.2008', 'dd.MM.yyyy', 'en_US');
print $zDate->getIso();
//
//[Warning]Zend\Date\DateObject.php:1016 timezone_open(): Unknown or bad 
timezone (2009)
//[Cause] if ([EMAIL PROTECTED]($zone)) { //
-----------

I think, if format not specify timezone, this shoud not verify it.

Thanks.


--
Haroldo Mitsumi Murata [K33]


Reply via email to