Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

how can I find the diffrence between two dates when each is in a diffrent format like (Y-m-d , d/m/Y)..But I don't want to use strtotime

user-image
Question ajoutée par Faizan Ahmad , Software Engineer , cardekho.com
Date de publication: 2013/04/05
Marouen Sayari
par Marouen Sayari , Senior PHP Programmer and Full-time Freelancer, Zend Certified Engineer , Self-employed

Since PHP 5.3 you can use the DateTime class Example: $date1 = new DateTime('date string'); $date2 = new DateTime('second date string'); $interval = $date1->diff($date2); echo $interval->format('%d'); //%d for number of days

you can (explode) the characters (/, -) from the two dates , and compare them with any algorithm you want .

Faizan Ahmad
par Faizan Ahmad , Software Engineer , cardekho.com

Rather days between two dates

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?