0

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (15/JAN/20) at position 0 (1):

...on line 26

$first_installment_date = new datetime($aData[0]->FIRST_INSTALL_DATE); 

php codeigniter was working fine before ...when i reinstall oracle n xampp..it shows error

2 Answers 2

4

15/JAN/20) is not a valid format for DateTime(). You will need to use DateTime::createFromFormat() to parse that date:

//Assuming YY/Mon/DD
$first_installment_date = DateTime::createFromFormat('y/M/d', $aData[0]->FIRST_INSTALL_DATE);
Sign up to request clarification or add additional context in comments.

3 Comments

thanks!! but how come that error occur before it was working fine but when i uninstall n reinstall xampp and oracle 11g xe it shows error!!! its is still working on my other PC same programs installed...
Really, I can't think of any reason off of the top of my head other then possibly different PHP versions supporting different date formats and one of the versions of PHP you installed is different then the others.
TQ ANYWAYS KEEP HELPING :p
-1
public __construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )

Are you sure the "$aData[0]->FIRST_INSTALL_DATE" isn't null?

PHP DateTime Documentation

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.