Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:27:23+00:00 2026-06-11T03:27:23+00:00

I have two variables, date & time… var date = 2012-12-05; var time =

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:27:24+00:00Added an answer on June 11, 2026 at 3:27 am

    This format is called ISO 8601

    Do you know what timezone you are in? If you do, you can do like this:

    var datetime = date + 'T' + time + ":00+0000';
    

    if the timezone is +0.
    if not, then:

    var d = new Date()
    var n = d.getTimezoneOffset();
    var timeZone = Math.floor( Math.abs( n/60 ) );
    var timeZoneString = (d.getTimezoneOffset() < 0 ? '-' : '+' ) + ( timeZone < 10 ? '0' + timeZone : timeZone ) + '00';
    
    var datetime = date + 'T' + time + ':00' + timeZoneString;
    

    Here is a fiddle: http://jsfiddle.net/ajySr/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two date time variables in javascript: first_date = Date.parse('05/21/2012 0:00:00 ');
In C++, if you have two variables a and b, you can do this
I have two Perl string variables containing date values. I want to check whether
I have two variables: char charTime[] = TIME; char buf[] = SOMETHINGELSE; I want
I have two environment variables in apache config, I want to concatenate them into
I have two variables, id and date . There are millions of distinct id
I have two data frames. The one consists of three variables, namely date, strike
I have two variables in my javascript. A message function : var message A
I have a text file that contains date, and two time-strings separated by spaces
I have two variables in a jquery code and if item.a not exist, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.