0

下面是我在对话框中的日期选择器代码,效果很好,但我想根据 php 服务器时间而不是本地时区设置我的默认日期和日历日期。为此,我正在尝试做一个预演,但根本没有开火。

任何人的任何建议???

        $('#chooseDt').click(function() { 
                $("#Date_calendar").dialog({
                        open: function(event, ui) {
                                    $( "#dpicker" ).datepicker({
                                        autoSize: true,
                                        showOtherMonths: true,
                                        numberOfMonths: 3,                          
                                        showCurrentAtPos: 1,
                                        onSelect: function(input, inst) {
                                            var currentDate = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
                                            var unixdate = currentDate.getTime() / 1000;
                                            $(this).datepicker('destroy');
                                            $(this).parent("div#Date_calendar").dialog( "close" );
                                            window.location.href="xxxxxx.php?homeday="+(unixdate);
                                        },
                                        beforeShow: function() {
                                            alert("A");
                                            //var theDate = new Date();
                                            //theDate.setDate('<?php echo date("d",strtotime($c_date)); ?>');
                                            // calenderDate is my global php variable with date used as currentdate in my php page
                                            //$(this).datepicker('option','defaultDate',calenderDate);         
                                        }
                                    });
                        },
                        close: function(event,ui) {
                            $(this).datepicker('destroy');
                        },
                        resizable: false,
                        modal: true,
                        minWidth: 760
                }).height("auto");
                $( "#Date_calendar" ).dialog('widget').css({'top' : '25%', 'left' : '30%','margin-top' : '-10%', 'margin-left' : '-100px'});    
            return false;   
    });
4

0 回答 0