Error creating Java Date in php -
im trying create php function converts string date java date pass java. need use java.sql.date not java.util.date application. simple function giving odd result:
function makestrjavadate($date){ $date = date_parse($date); $date = new java("java.sql.date",$date['year'], $date['month']-1, $date['day']); return $date; }
the date java returned has wrong year: php (for 2011-07-01), java(jul 1, 3911).
any pointers whats wrong?
fyi, php parsing correctly:
array ( [year] => 2011 [month] => 7 [day] => 1 [hour] => [minute] => [second] => [fraction] => [warning_count] => 0 [warnings] => array ( ) [error_count] => 0 [errors] => array ( ) [is_localtime] => )
evidently, it's considering year start @ 1900. subtract 1900 when pass year.
Comments
Post a Comment