a_sid
0
Q:

php current time

$today = date("F j, Y, g:i a");   // October 30, 2019, 10:42 pm
$today = date("D M j G:i:s T Y"); // Wed Oct 30 22:42:18 UTC 2019
$today = date("Y-m-d H:i:s");     // 2019-10-30 22:42:18(MySQL DATETIME format)
7
date("Y-n-j G:i:s");
//-->2020-10-29 23:27:15
1
strtotime("now");

// strtotime is a function that will take a string parameter 
// that specifies a date, and returns a unix time stamp bassed
// on that

echo strtotime("2020-02-24");

// prints: 1582502400
0

<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
                   // 7 Tage; 24 Stunden; 60 Minuten; 60 Sekunden
echo 'Jetzt:          '. date('Y-m-d') ."\n";
echo 'Naechste Woche: '. date('Y-m-d', $nextWeek) ."\n";
// oder strtotime() verwenden:
echo 'Naechste Woche: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>

1

 <?php
$d=mktime(11, 14, 54, 8, 12, 2014);
echo "Created date is " . date("Y-m-d h:i:sa", $d);
?> 
1
<?php
$t=time();
echo($t . "<br>");
echo(date("Y-m-d",$t));
?>
2

New to Communities?

Join the community