我使用Fullcalendar 1.5.3和JQuery 1.7.2 - 在我的本地時區數據顯示完美,但在其他時區它間歇性地工作我假設由於相對於當地時間的時間差區。Fullcalendar和時區
我正在從一個文件中取出一個JSON提要,並將這些日期作爲Y-m-d存儲在MySQL中。
我已經閱讀了ignoreTimezone,並在fullcalendar.js和頁面上的日曆對象調用中將它設置爲false和true,但它沒有任何區別。 ignoreTimezone的文檔提到了在我的ISO8601日期上工作的情況。
在下面的具體示例中,美國西海岸的一位客戶將聖誕節的日期顯示爲12月24日 - 我已經從客戶端獲得他們使用多個瀏覽器和機器的確認信息,並且我遇到了多個客戶端,以便它聽起來像它不侷限於一個客戶機等
下面是代碼:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
ignoreTimezone: false,
titleFormat: {
month: 'MMMM yyyy',
week: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}",
day: 'dddd, MMM d, yyyy'
},
columnFormat: {
month: 'ddd',
week: 'ddd d/M',
day: 'dddd d/M'
},
timeFormat: { // for event elements
'': 'H(:mm)t' // default
},
eventSources: [
'public_holidays_feed.php'
]
})
});
</script>
我的JSON飼料的剪斷顯示:
[
{"id":"1","title":"New Year's Day (USA)","start":"2012-01-02","end":"2012-01-02","backgroundColor":"#000000","allDay":true},
{"id":"2","title":"New Year's Day (UK)","start":"2012-01-02","end":"2012-01-02","backgroundColor":"#000000","allDay":true},
{"id":"3","title":"Birthday of Martin Luther King, Jr. (USA)","start":"2012-01-16","end":"2012-01-16","backgroundColor":"#000000","allDay":true},
{"id":"4","title":"Washington's Birthday (USA)","start":"2012-02-20","end":"2012-02-20","backgroundColor":"#000000","allDay":true},
{"id":"5","title":"Good Friday (UK)","start":"2012-04-06","end":"2012-04-06","backgroundColor":"#000000","allDay":true}
]
我怎樣才能得到上述忽略當地的時區,只使用服務器時區,所以如果MySQL的日期說2012-12-25那麼這就是每個人都應該看到,無論他們在哪裏?
感謝
什麼是您的服務器時區? – ganeshk
服務器時區格林威治標準時間 – bhttoan
任何人?請。 – juanpastas