ConfusedGrayMatter Posted January 18, 2006 Share Posted January 18, 2006 Besides using the substring, how do I seperate the values from this datetime datatype.I'm using an asp Jscript page to bring in the value and I am returning a date like 1/1/1900 or 12/16/2004 and I don't know how to correctly use javascript to seperate the month, day and year for use as individual variables.Thanks for your time. Link to comment Share on other sites More sharing options...
aspnetguy Posted January 18, 2006 Share Posted January 18, 2006 take a look at thishttp://www.web-source.net/web_development/...script_date.htm Link to comment Share on other sites More sharing options...
ConfusedGrayMatter Posted January 18, 2006 Author Share Posted January 18, 2006 Thank You.Well, now I feel like a blockhead. Once I saw that example it clicked.In case someone else finds this thread looking for a similar answer to this kind of question, I thought I'd write a quick little block of code to perhaps make it even more simple.<%var BirthDay = String("8/10/2004");var bDate = new Date(BirthDay);var bMonth = bDate.getMonth() + 1;var bDay = bDate.getDate();var bYear = bDate.getYear();Response.Write("Birthday: " + BirthDay);Response.Write("<br>");Response.Write("Birth Month: " + bMonth);Response.Write("<br>");Response.Write("Birth Day: " + bDay);Response.Write("<br>");Response.Write("Birth Year: " + bYear);%>Results are:Birthday: 8/10/2004Birth Month: 8Birth Day: 10Birth Year: 2004 Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now