note 57276 added to function.date
| From: | defcon5 at home dot nl | Date: | Thu, 29 Sep 2005 08:30:08 +0000 |
| Subject: | note 57276 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95958@lists.php.net to get a copy of this message | ||
Well i want convert a unix time stamp to the lokaltime.
So i made this script that should do the trick.
Verry simple, but you need to think of it.
<?php
$lokaltime = time()."<br>";
echo $lokaltime;
echo date('d-m-Y / H:i:s',$lokaltime)."<br>";
?>
So this also helpfull for users that has a unix time stamp in their dbases so you can do the
following trick.
<?php
$insert = mysql_query( INSERT INTO [dbase_table] (date) VALUES ( ".time()." ) );
?>
and out
<?php
$result = mysql_query( SELECT * FROM [dbase_table]);
while($row = mysql_fetch_object($result)) {
echo date('d-m-Y / H:i:s',$row->date);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57276
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57276&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57276&report=yes
Search -- http://master.php.net/manage/user-notes.php