How to get time and Date from datetime stamp in php and mysql?

You can use the strtotime php function to separate date and time from datetime string. It can come in handy when you need to separate date and time from datetime format in the mysql database.
   $datetime = '2013-08-14 11:45:45';
   echo date("Y-m-d",strtotime($datetime)); // output 2013-08-14
   echo  date("H:i:s",strtotime($datetime)); // output 11:45:45
Small and simple solution. :)

Comments

  1. hello mam ager ham ne db se date echo karwaye use hm y-m-d me frmet me kese chanj kare ge

    ReplyDelete

Post a Comment

Popular Posts