我在我的 Rails 应用程序中使用 date-range-picker 添加日期时间,但是当我们创建或更新日期时间时,服务器上会更新但 +6 小时。
在我的配置文件中添加:config.time_zone = "Mexico City"
对于选择日期范围:
$('#ordenes_servicio_OS_FECHAASIGNACION, \
#ordenes_servicio_OS_FECHALLEGADA, \
#ordenes_servicio_OS_FECHAINCIO, \
#ordenes_servicio_OS_FECHAFIN, \
#ordenes_servicio_OS_FECHATERMINO').daterangepicker({
"singleDatePicker": true,
"timePicker": true,
"timePickerSeconds": true,
"autoApply": true,
"locale": {
"format": "DD/MM/YYYY h:mm:ss A",
"separator": " - ",
"fromLabel": "From",
"toLabel": "To",
"customRangeLabel": "Custom",
"weekLabel": "W",
"daysOfWeek": [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ],
"monthNames": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"firstDay": 1
},
"showCustomRangeLabel": false,
"opens": "center"
});
来自 params 的参数 =
"OS_FECHAASIGNACION"=>"20/04/2018 6:53:08 AM"
更新查询:
UPDATE `ordenes_servicios` SET `OS_FECHAASIGNACION` = '2018-04-20 11:53:08', `updated_at` = '2018-04-03 05:57:30' WHERE `ordenes_servicios`.`ID` = 5
请给我确切的答案,我们如何将日期时间作为 utc-6 更新到服务器?正如我们从参数中设置的那样。