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

  • Home
  • SEARCH
  • 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 903919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:57:58+00:00 2026-05-15T15:57:58+00:00

function setValue() { var startTime = document.getElementById(‘ToilA’); var endTime = document.getElementById(‘EndHours’); startTime = startTime.value.split(:);

  • 0
function setValue() { 
var startTime = document.getElementById('ToilA'); 
var endTime = document.getElementById('EndHours'); startTime = startTime.value.split(":"); 
var startHour = parseInt(startTime[0], 10); 
var startMinutes = parseInt(startTime[1], 10); 
endTime = endTime.value.split(":"); 
var endHour = parseInt(endTime[0], 10); 
var endMinutes = parseInt(endTime[1], 10); 
//var hours, minutes; 
var today = new Date(); 
var time1 = new Date(2000, 01, 01, startHour, startMinutes, 0); 
var time2 = new Date(2000, 01, 01, endHour, endMinutes, 0); var milliSecs = (time2 - time1); 
msSecs = (1000); 
msMins = (msSecs * 60); 
msHours = (msMins * 60); 
numHours = Math.floor(milliSecs/msHours); 
numMins = Math.floor((milliSecs - (numHours * msHours)) / msMins); 
numSecs = Math.floor((milliSecs - (numHours * msHours) - (numMins * msMins))/ msSecs); numSecs = "0" + numSecs;
numMins = "0" + numMins;
DateCalc = (numHours + ":" + numMins); 

document.getElementById('CalculateHours').value = DateCalc; }

I have one more issue with this code, there is a leading 0 when the minute part is over 10.

so it return something like 11:013 rather that 11:13, can this be fixed with math or will an if statement fix this? Like if number of items > 2, remove first item?

I was going to just do a PHP script to remove this when the form is submitted, but it doesn’t look good.

  • 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-05-15T15:57:59+00:00Added an answer on May 15, 2026 at 3:57 pm

    Change numMins = "0" + numMins to

    if (numMins < 10)
        numMins = "0" + numMins;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer VLC can play webm and vp8 videos since version 1.1.0,… May 17, 2026 at 12:19 am
  • Editorial Team
    Editorial Team added an answer This is the code I'm using on my site: <link… May 17, 2026 at 12:19 am
  • Editorial Team
    Editorial Team added an answer Your program compiles, but it does not link. The problem… May 17, 2026 at 12:19 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

In this code: <?php class Foo { var $value; function foo($value) { $this->setValue($value); }
Suppose I have javascript within ASP.NET UserControl: function setValue(DataItem) { var selectedDate = DataItem.getMember('DomainNameKey').get_object();
Basically this script will subtract StartTime from EndTime, using a jQuery plugin the html
Im making firefox extension. One function stores value in every tab, to use it
I have a function, say: setValue: function(myValue) { ... } The caller might pass
I use, google.load('visualization', '1', {'packages': ['columnchart']}); //google.setOnLoadCallback(drawChart); function drawChart(response) { alert(response.customerlist); var data =
function rp_marcadesmarcaFarm(valor) { FM_log(3, marcadesmarcaFarm called = +valor); for (i = 0; i <
I am attempting to create a generic mapping function that takes the values of
Wanted for property grid, in the PropertyType function of the class derived from PropertyDescriptor,
While i am trying to create object like this new Ext.TitleCheckbox () I am

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.