?
Solved

toUTCString -- parse the parts of the date

Posted on 2011-03-18
4
Medium Priority
?
456 Views
Last Modified: 2012-06-27
I was trying to convert my date to GMT and then get each individual date part but it won't let me use the normal getMonth, getDate, etc--I'm guessing because it converted the date to a string?   How can I get the individual parts of the date like my code below the following 2 lines?   The date has to be in GMT.

dteDate = new Date();
dteDate = dteDate.toUTCString();


// this is how i originally broke the date apart before converting to GMT      
var dteMonth = dteDate.getMonth() + 1;
var dteDay = dteDate.getDate();
var dteYear = dteDate.getYear();
var dteHours = dteDate.getHours();
var dteMin = dteDate.getMinutes();
var dteSec = dteDate.getSeconds();
0
Comment
Question by:saturation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 35168385
0
 
LVL 82

Expert Comment

by:leakim971
ID: 35168391
dteDate = new Date();
dteDate = formatDate(d);

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 35168395
oups
dteDate = new Date();
dteDate = formatDate(dteDate);

Open in new window

0
 

Author Closing Comment

by:saturation
ID: 35168615
Perfect!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question