PHP 日期相關

Categories: dreamweaver, 資料庫
Comments: No Comments
Published on: 2011/08/05
<strong>代碼:</strong> mysql&gt; select NOW(), TO_DAYS(NOW()), CURDATE(), TO_DAYS(CURDATE());
+---------------------+----------------+------------+--------------------+
| NOW()               | TO_DAYS(NOW()) | CURDATE()  | TO_DAYS(CURDATE()) |
+---------------------+----------------+------------+--------------------+
| 2007-01-25 13:11:53 |         733066 | 2007-01-25 |             733066 |
+---------------------+----------------+------------+--------------------+
1 row in set (0.00 sec)

mysql&gt; select TO_DAYS(NOW())-10, TO_DAYS(CURDATE())-10;
+-------------------+-----------------------+
| TO_DAYS(NOW())-10 | TO_DAYS(CURDATE())-10 |
+-------------------+-----------------------+
|            733056 |                733056 |
+-------------------+-----------------------+
1 row in set (0.00 sec)

mysql&gt; select NOW(), FROM_DAYS(TO_DAYS(NOW())-10), CURDATE(), FROM_DAYS(TO_DAYS(CURDATE())-10);
+---------------------+------------------------------+------------+----------------------------------+
| NOW()               | FROM_DAYS(TO_DAYS(NOW())-10) | CURDATE()  | FROM_DAYS(TO_DAYS(CURDATE())-10) |
+---------------------+------------------------------+------------+----------------------------------+
| 2007-01-25 13:12:07 | 2007-01-15                   | 2007-01-25 | 2007-01-15                       |
+---------------------+------------------------------+------------+----------------------------------+
1 row in set (0.00 sec)

將伺服器的時區改變

Categories: dreamweaver, software
Tags: , ,
Comments: No Comments
Published on: 2011/08/05

先找到 php.ini

裡面會有以下的 code

[Date]
; Defines the default timezone used by the date functions
;date.timezone =

 

改成

[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Taipei

php寫入lunarpages mysql 的伺服器日期格式

Categories: dreamweaver
Comments: No Comments
Published on: 2008/03/29

<?php echo date (‘Y-n-d G:i:s’,time() + 54000); ?>

ixwebhosting 的是

<?php echo date (‘Y-n-d G:i:s’,time() + 43200); ?>

附註:

54000秒 = 16 個小時

43200秒 = 12 個小時

page 1 of 1

Views

Welcome , today is 星期六, 2024/11/23
Clef two-factor authentication