Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:03:44+00:00 2026-06-15T07:03:44+00:00

In table I have field type TIME where I am storing time interval e.g.

  • 0

In table I have field type TIME where I am storing time interval e.g. 92:30:00, what I am trying to do with javascript (datejs) is to add or remove e.g. 02:15:00 to/from 92:30:00.

I am able to do it when the hours are not greater than 23:59 but how to do it when the values are over 23:59?

grab a from db //as 92:30
var b = Date.parse(a);
var c = Date.parse("02:15");

    d= new TimeSpan(b-c);
    e= (b).addHours(c);

console.log(d.toString("HH:mm")
console.log(e.toString("HH:mm")

as I sad it works If you stay in 24h time range, could it be possible to do the same with greater hours interval?

UPDATE:
(sum them)

t = Date.today();
cc = Date.parse(c);
dd = Date.parse(d);

ccc = (cc - t)
ddd = (dd - t);

res = new TimeSpan(ccc+ddd);
console.log(res.toString()); //3.22:45:00
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:03:45+00:00Added an answer on June 15, 2026 at 7:03 am

    I don’t think Datejs is going to parse a >24 hour time value correctly. The easiest work-around I can think of is just splitting the string into its parts and adding to Date.today().

    Here’s a sample demonstrating the whole scenario.

    Example

    var a = '92:30'.split(':');
    var b = '02:15'.split(':');
    
    var c = Date.today().addHours(+a[0]).addMinutes(+a[1]);
    var d = Date.today().addHours(+b[0]).addMinutes(+b[1]);
    
    var e = new TimeSpan(c - d);
    
    console.log('days', e.days);  // 3
    console.log('hours', e.hours);  // 18
    console.log('minutes', e.minutes);  // 15
    

    I’m not 100% what you would like as an end result, but once you have the e TimeSpan you have the product of subtracting the two original values.

    Hope this helps.

    EDIT: If you just want to do simple math on the value to calculate an hours value, the following should work.

    Example

    var a = '92:30'.split(':');
    var b = '02:15'.split(':');
    
    var c = Date.today().addHours(+a[0]).addMinutes(+a[1]);
    var d = Date.today().addHours(+b[0]).addMinutes(+b[1]);
    
    var diff = (c - d) / (1000 * 60 * 60);
    
    console.log(diff); // 90.25
    

    You shouldn’t require Datejs to do this though. Just using the native JavaScript Date API is all you need and you could remove any of Datejs API from the above sample.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql table field set as time type which stores data in
All rows in a table have a type field which is either 0 or
Ok I'm using SQL Server 2008 and have a table field of type VARCHAR(MAX)
I have this Points table: =========================================== FIELD : TYPE =========================================== id int(11) user_id int(11)
I have a table with a field of type date within a MySQL database.
I have a table: +----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key |
I have a table: +--------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key |
I have a table like this : +-------+------------+------+-----+---------+-------+ | Field | Type | Null
I have a boolean (BOOL) type field in the SQLite table. In the SubSonic
I have a table abc with a field datetime_abc type-> DATETIME in mysql. and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.