Skip to main content
deleted 73 characters in body
Source Link
Kris
  • 8.8k
  • 4
  • 43
  • 70
var diff =
    new Date( '01/01/2009 ' + $('#fTime').val()) -
    new Date( '01/01/2009 ' + "03:00 PM" );

var hours=(diff / 1000)+"";//just to make it a string
var mins=(diff / 1000 / 60 )+"";

var diff_time=hours+":"+mins;

use diff_timehours+":00" for outputs like "22:00" hrs Also, find the time format should have a AM/PM

var diff =
    new Date( '01/01/2009 ' + $('#fTime').val()) -
    new Date( '01/01/2009 ' + "03:00 PM" );

var hours=(diff / 1000)+"";//just to make it a string
var mins=(diff / 1000 / 60 )+"";

var diff_time=hours+":"+mins;

use diff_time for outputs like "22:00" hrs Also, find the time format should have a AM/PM

var diff =
    new Date( '01/01/2009 ' + $('#fTime').val()) -
    new Date( '01/01/2009 ' + "03:00 PM" );

var hours=(diff / 1000)+"";//just to make it a string

use hours+":00" for outputs like "22:00" hrs Also, find the time format should have a AM/PM

Source Link
Kris
  • 8.8k
  • 4
  • 43
  • 70

var diff =
    new Date( '01/01/2009 ' + $('#fTime').val()) -
    new Date( '01/01/2009 ' + "03:00 PM" );

var hours=(diff / 1000)+"";//just to make it a string
var mins=(diff / 1000 / 60 )+"";

var diff_time=hours+":"+mins;

use diff_time for outputs like "22:00" hrs Also, find the time format should have a AM/PM