I am trying to get current time and date in order to echo it out on my website. I have the follow snippet:
$date_of_msg = date("Y-m-d");
$time_of_msg = time();
When I echo $time_of_msg
I get 00:00:00
. I have tried to edit my code based on this solution here but which this approach, when I echo the variable, I get 838:59:59
. I simply want the current time to be displayed in 24 hour format.
In addition to this, I currently have the date formatted to (Y-m-d), which is great because it works. I am trying to format it so that it displays day, number, year
, i.e. today is 20th Feb, so I want the date to display Feb 20, 2016
. I have tried the following based on documentation (see here)
$date_of_msg = date("F j, Y")
But again, the date displays nothing. Am I missing something?