我想显示日期,也要从daterangepicker输入字段中获取值。我需要以日期格式显示的时区。您能帮我知道如何将时区添加到datetime格式吗?
$('#dateTimeInput').daterangepicker({
startDate: start,
endDate: end,
timePicker: true,
timePickerSeconds: true,
timePicker24Hour: true,
locale: {format: "DD/MM/YYYY hh:mm:ss"},
ranges: {
'Today': [moment().startOf('hour'), moment().startOf('hour').add(24, 'hour')],
'Yesterday': [moment().subtract(1, 'days').startOf('hour'), moment().subtract(1, 'days').startOf('hour').add(24, 'hour')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}}, updateSelectedDateRange);
function updateSelectedDateRange(start, end) {
$('#dateTimeInput span').html(start.format('DD/MM/YYYY hh:mm:ss') + ' - ' + end.format('DD/MM/YYYY hh:mm:ss'));
}
updateSelectedDateRange(start, end);
//while fetching
var drp = $('#dateTimeInput').data('startDate').format("DD/MM/YYYY hh:mm:ss");