ok i want to join today date with some specific time.

for example
$strTime = '00:00:01';
$date = date('Y-m-d');
$datetime = $date ." ". $strTime;

but when i echo $datetime, it just show me today date only. Why i can't join date and time???

i am thinking essit need to convert the date to string first before i join. so what is the command for convert to string?

    have you tried this?

    $strTime = '00:00:01';
    $date = date('Y-m-d');
    $datetime = "$date $strTime";
    

    as Shryku said... it should work what you have... but never hurts to try alternatives....

    alternatively....

    $strTime = '00:00:01';
    $datetime = date("Y-m-d $strTime");
    

    should also work... since you can have date() return text along with the formatting (escaping any date() related codes sugh as Y m d etc etc with \'s)

      Write a Reply...