When I make this conversion
$date = '09/20/2012 02:00';
echo $stamp = strtotime($date);
gives me 1348099200 but when I convert it online through a website it shows the time 2 hours earlier.
How can I add 2 hours?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
strtotimefunction is always relative tonow()which is relative to a php.ini setting called timezone something (actually:date.timezone, see below for a link).So you should say in which timezone your server (or website) is located, configure it and you should not need to add those two hours. These two hours even might change if the daylight saving changes, so do not encode it hard into your application.
date_default_timezone_setDocsdate.timezonestringDocs(Assumption: Greece UTC+2 right now, however it’s summer)