dotJoon
November 26, 2010, 8:51pm
1
I like to print current date and current time.
The code below seems not to work correctly.
[B]would-be code[/B]
<?php
echo date()
?> <br>
<?php
echo time()
?>
[B]target output[/B]
2010-11-27
05:50.11
or
20101127
055011
or
some other type of date and time
time() generates a timestamp and date will use the current time to generate it’s output as well. What doesn’t seem to work for you exactly?
Cheers,
Alex
dotJoon
November 26, 2010, 9:35pm
3
The result of the code below says “Warning : date() expects at least 1 parameter, 0 given in http://dot.kr/x-test\\date.php on line 2”
<?php
echo date()
?>
How can I fix the warning?
<?php
echo date("Y-m-d");
?>
<br />
<?php
echo date("g:i:s");
?>