範例
#--------------------------------------------------------------------- $time=xoops_getUserTimestamp(time()); # xoops 使用者時間 1364583916 #--------------------------------------------------------------------- $today = getdate($time ); # 格式化日期(xoops 使用者時間) 顯示畫面 Array ( [seconds] => 16 [minutes] => 5 [hours] => 19 [mday] => 29 [wday] => 5 [mon] => 3 [year] => 2013 [yday] => 87 [weekday] => Friday [month] => March [0] => 1364583916 ) #--------------------------------------------------------------------- $today1 = getdate(); # 格式化日期(主機時間) Array ( [seconds] => 16 [minutes] => 5 [hours] => 11 [mday] => 29 [wday] => 5 [mon] => 3 [year] => 2013 [yday] => 87 [weekday] => Friday [month] => March [0] => 1364555116 ) #--------------------------------------------------------------------- $today2 = getdate(userTimeToServerTime($time)); # 格式化日期(將xoops 使用者時間,還原成主機時間) 儲存進資料庫 Array ( [seconds] => 16 [minutes] => 5 [hours] => 11 [mday] => 29 [wday] => 5 [mon] => 3 [year] => 2013 [yday] => 87 [weekday] => Friday [month] => March [0] => 1364555116 ) #---------------------------------------------------------------------
沒有留言:
張貼留言