|
-
Jun 24th, 2004, 10:00 AM
#1
Thread Starter
Addicted Member
[Resolved] Date-Time Java Script Question
I have a html form that has date values formated like so inside a text input:
22-Jun-2004 16:31:38
I want to convert that into a unix timestamp so that i can take 2 timestamps and calculate time differences between them. (big int - smaller int).
Does anybody know of a quick and easy way of converting the above string into a unix time stamp in java script? Any help would be much appreciated
Last edited by SineX; Jun 24th, 2004 at 10:27 AM.
-
Jun 24th, 2004, 10:12 AM
#2
Thread Starter
Addicted Member
Sorry, here is my current non-working attempt
The Function
Code:
function humanToTime()
{
var date1 = document.billing.FromTime1.value
date1 = date1.replace("-", " ")
date1 = date1.replace("-", " ")
var d = new Date(date1)
document.billing.ToTime1.value = (d.getTime() / 1000)
}
And I'm calling it with this:
Code:
<input name="FromTime1" id="FromTime1" type="text" size="10" onchange="JavaScript:humanToTime()"><a href="JavaScript:NewCal('FromTime1','ddmmmyyyy',true,24)"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
-
Jun 24th, 2004, 10:27 AM
#3
Thread Starter
Addicted Member
nevermind i found the solution...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|