This is a discussion on convert a text string into a Date object. within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... Can any one tell me how can i convert a text string: "Wed Aug 26 14:40:...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all... <script language="JavaScript"> var textdate = 'Wed Aug 26 14:40:45 MET DST 1998.'; var myArray = textdate.split(' '); var input = myArray[0] + ', ' + myArray[2] + ' ' + myArray[1] + ' ' + myArray[3] + ' ' + myArray[6].substring(0,4); var output = Date.parse(input); var mydate = new Date(output) </script> Thanks... |
| |||
| <script> d = new Date() //today's date mill=new Date(3000, 00, 01, 00, 00, 00) //Next millennium start date diff = mill-d //difference in milliseconds mtg = new String(diff/86400000) //calculate days and convert to string point=mtg.indexOf(".") //find the decimal point days=mtg.substring(0,point) //get just the whole days document.write("There are only " + days + " days remaining to the start of the next millennium.") </script> |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Convert String to Date: new Date(string) | oxygen | Flash Actionscript Programming | 3 | 03-07-2008 09:24 PM |
| Convert a date in milliseconds back to a date string | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 03-03-2008 09:03 PM |
| How do I work out the date seven days before a text string mm/dd/yy? | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 01-01-2008 08:42 PM |
| Need Help: convert string to unknown class object c#? | a.deeban | C# Programming | 0 | 08-16-2007 05:18 AM |
| How to convert a date to a globally accepted date format, in DOT NET 2005? | Archer | C# Programming | 1 | 07-25-2007 03:21 AM |