hi, all
i face a problem, when i mkdate (), the date was increase a day.
such as i get today as $date_from.... 26/03/2003.
when i echo it...
echo date("m/d/Y", mktime($date_from)) ;
the date was 03/27/2003...
any method can be reduce the day?
Thank you for help.
convert date
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
It's showing you today's date because you are using the mktime() function incorrectly:
Instead of doing this:
you need to do something like:
Mac
Code: Select all
mktime ( int hour, int minute, int second, int month, int day, int year ї, int is_dst])Code: Select all
$date_from = '26/03/2003';
echo date("m/d/Y", mktime($date_from));Code: Select all
$date_from = explode('/', '26/03/2003');
$timestamp = mktime(0, 0, 0, $date_from[1], $date_from[0], $date_from[2]);
echo date('m/d/Y', $timestamp);