Solved

toUTCString -- parse the parts of the date

Posted on 2011-03-18
4
444 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
  • 3
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now