How do I get the system date and time in this format:
$systime="12/january/2010 10.30 AM "
How do I get the system date and time in this format:
$systime="12/january/2010 10.30 AM "
To get exactly what you've asked for, you'll need to use strtolower()
and date
:
$systime = strtolower(date("d/F/Y G.i")) . " " . date("A") . " ";
You need strtolower
because there's no built-in way to get lowercase month values, so you need to get that part as January
and then transform it to lowercase. You can't lowercase the whole thing because you seem to want AM
or PM
rather than am
or pm
.
Try:
$systime = date('d/F/o g i A');
Sample output:
05/March/2010 7 27 AM
Using date and strftime() we can get the system date.
Example:
echo date("d/F/Y g:i A");//It prints 05/March/2010 12:18 PM
echo strftime("%d/%B/%Y %I:%M %p"); //It prints 05/March/2010 12:20 PM
http://stackoverflow.com/questions/2385106/get-system-time-using-php
Why do you ask your question 2 times ??