Jump to content

[SOLVED] How to get current time from PHP time() function


watthehell

Recommended Posts

$t = time();
$d = date("j \of F Y, \a\\t g.i a", $t);
$d2 = date("r", $t);
print "time: ".$t."<br>";
print "date: ".$d."<br>";
print "date2: ".$d2."<br>";

 

I don't need date only time

 

i did

$t = time();

print $t;

 

it come like this

 

1189757419

I tweaked your code lil' bit and finally  the output was really great thanks ;)

 

<?php
$my_current_time=date("h:i");
echo $my_current_time;
?>

 

But another problem it returned the time as 14.20 when my pc time is 2:20. Can't we get 2.20 instead of 14 ?? Is that possible...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.