codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Hello!! Urgent Issue..  haripriya amaresan at 04:43 on Wednesday, November 29, 2006
 

Hello Everybody,

I have an urgent issue to be solved. I need to calculate the difference between two moments of time in java script.One time variable will be got from the form textbox and another will be got from DB and stored in the form as hidden variable.

Let the variable from form be
time1="8:00:00"
and from the db be
time2="16:25:45"

I need to find time1-time2.

Pls help me to get through this...

Thanks for ur timely Help.

  Re: Hello!! Urgent Issue..  amitvps at 08:41 on Wednesday, November 29, 2006
 

you can do it as follows:
var StartTime= new Date(00,00,0000,08,10,00);
var EndTime= new Date(00,00,0000,08,25,00);
var DiffTime = new Date();
DiffTime = EndTime - StartTime;


But the output will be in mili-seconds. To make seconds divide DiffTime by 1000. Again to make minutes, divide DiffTime by 60 etc.









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007