converting datetime to date

Posted on 2012-08-22
Medium Priority
Last Modified: 2013-01-25
I need to convert datetime to date using javascript, any suggestions would be appreciated.
Question by:Mike Johnson
LVL 25

Expert Comment

ID: 38323764
Not sure I understand. A JavaScript date object has a time component.  Are you trying to convert a string into a date object?

Please provide an example.

Assisted Solution

Alex_W earned 1000 total points
ID: 38323770
You could use:
myDateParts = myDate.split("/");
myJSDate = new Date(myDateParts[2], myDateParts[1], myDateParts[0]);

Or it would be easier if you are getting it from a SQL database to make the conversion there?
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38323808
Next time please provide input and expected output in your question
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

LVL 41

Expert Comment

ID: 38324479
Might this article be of any assistance?

LVL 78

Accepted Solution

slightwv (䄆 Netminder) earned 1000 total points
ID: 38324595
>>Or it would be easier if you are getting it from a SQL database to make the conversion there?


Since this was posted in an Oracle zone I have to assume an Oracle database.  In Oracle dates have an internal format.  They can be displayed however you want when selected and converted into strings.

select to_char(some_date_column,'MM/DD/YYYY'),
  to_char(some_date_column,'MM/DD/YYYY  HH24:MI:SS'),
  to_char(some_date_column,'MM/DD/YYYY HH:MI:SS AM')
from table;

The formats are pretty much endless:
LVL 53

Expert Comment

ID: 38818103
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

839 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