I have two variables, date & time…
var date = "2012-12-05";
var time = "18:00";
How can I format this into a UTC formatted date. This is so I can use it within the Facebook API..
Facebook states I need it in this format:
Precise-time (e.g., ‘2012-07-04T19:00:00-0700’): events that start at a particular point in time, in a specific offset from UTC. This is the way new Facebook events keep track of time, and allows users to view events in different timezones.
Any help would be much appreciated.. Thanks!
This format is called
ISO 8601Do you know what timezone you are in? If you do, you can do like this:
if the timezone is +0.
if not, then:
Here is a fiddle: http://jsfiddle.net/ajySr/