請任何人都可以幫忙!日期函數格式php
我想要的日期是按以下格式
Wed Oct 09 2013 14:48:26 GMT+0530 (India Standard Time) //this one is what jquery Date(); returns
但我我使用
date('D M d Y H:i:s eO (T)');
的問題得到它在
Wed Oct 09 2013 15:42:38 Asia/Kolkata+0530 (IST)
是jQuery是返回我與GMT + 0530約會和PHP返回亞洲/加爾各答+ 0530
編輯
我把一個計時器在我的代碼,它顯示在自登錄,所以在登錄時我使用PHP日期函數來設置在會話中的當前日期時間寫上面,但問題是新的Date()函數的jQuery返回的日期格式不是PHP中的日期。請在下面找到
PHP代碼代碼:
date_default_timezone_set("GMT+0530");
$_SESSION['loggedin'] = date('D M d Y H:i:s eO (T)'); // returns Wed Oct 09 2013 15:42:38 Asia/Kolkata+0530 (IST)
JS代碼://JS date function returns time as Wed Oct 09 2013 14:48:26 GMT+0530 (India Standard Time)
$(document).ready(function(){
if($('#logged').val()!=''){
var pageVisisted = new Date($_SESSION['loggedin']);
setInterval(function() {
var timeOnSite = new Date() - pageVisisted;
var secondsTotal = timeOnSite/1000;
var hours = Math.floor(secondsTotal/3600);
var minutes = Math.floor(secondsTotal/60) % 3600;
var seconds = Math.floor(secondsTotal) % 60;
var showtime = "Logged in Since ";
if(hours>0){
showtime = showtime + hours + " hours and ";
}
showtime = showtime + minutes + " mins";
document.getElementById('counter').innerHTML = showtime;
}, 1000);
}
});
這可能對您有所幫助[http://stackoverflow.com/questions/19245556/error-in-showing-outlook-appointment-time-using-php](http://stackoverflow.com/questions/19245556/error-in-showing-outlook-appointment-time-using-php) –
@KishorSubedi,沒有幫助,thnx btw –
你究竟在做什麼?你沒有很好地描述這個問題。請同時顯示javascript代碼和php代碼。你要去哪個方向?我無法從你的問題中得知。 –