douxian1923 2012-08-06 14:40
浏览 78

存储未来日期或当前时间戳

I am trying to get my website to have an entry form in order to add a future date if necessary. I'm trying to use the JQuery tool and this is the JS that I found that was a close match.

$(function() {
$('.date-picker').datepicker( {
    changeMonth: true,
    changeYear: true,
    changeDay: true,
    showButtonPanel: true,
    dateFormat: 'Y/m/d H:i:s',
    onClose: function(dateText, inst) { 
        var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
        var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
        var day = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
        $(this).datepicker('setDate', new Date(year, month, day));
    }
    formatDate()
});
});

I found this online but it only displays the Month and the year. The user should have the ability to pick a future date and the timestamp would be set for 12:01am of that future date but the user should also have the ability to pick the current date. If the current date is selected I wanted to leave it null and let the mysql time stamp work. Any Advice/Help would be appreciated Thanks,

  • 写回答

0条回答 默认 最新

    报告相同问题?