jQuery UI DatePicker日期转换为RFC 3339格式

编程入门 行业动态 更新时间:2024-10-27 04:37:38
本文介绍了jQuery UI DatePicker日期转换为RFC 3339格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

目前在Google Calendar API上工作,基本上我的结束将为用户提供开始和结束日期来选择日期和时间。但愿任何人建议如何将它们从(DatePicker / TimePicker / input field)转换为RFC 3339格式(例如2013-07-24T10:00:00.000-07:00)。

Currently working on the Google Calendar API and basically my end will provide Start and End date for user to pick the date and time. But would like anyone to advise how to convert them from (DatePicker/TimePicker/input field) to RFC 3339 format (e.g. 2013-07-24T10:00:00.000-07:00).

推荐答案

var date = new Date(); var timeZone = date.getTimezoneOffset(); alert(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "T" + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + "." + date.getMilliseconds() + (timeZone > 0 ? "-" : "+") + Math.floor(Math.abs(timeZone) / 60) + ":" + Math.abs(timeZone) % 60);

更多推荐

jQuery UI DatePicker日期转换为RFC 3339格式

本文发布于:2023-11-03 16:51:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555611.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   日期   格式   UI   jQuery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!