Jump to content

how to change date to yyyy-mm-dd and reverse?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Hamed

Hamed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
Hello
I want to save date in data base but I need to get date in yyyy-mm-dd format and change it to one number?
and after that I would like change this one number to yyyy-mm-dd format how can I do it?


After I use these codes I get time 8999!! how to fix it?

        $sdate = $_POST['sdate'];
        $edate = $_POST['edate'];
        $num = intval($_POST['num']);
        $time = intval($_POST['time']);
        $sdate = mktime(0,0,0,date("m",$sdate),date("d",$sdate),date("Y",$sdate));
        $edate = mktime(24,59,59,date("m",$edate),date("d",$edate),date("Y",$edate));

Edited by Hamed, 24 December 2010 - 08:47 AM.


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
$t = strtotime("2010-12-24");
echo date("Y-m-d", $t);





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users