Advertisement

11.04.2005 at 02:25PM PST, ID: 21620052
[x]
Attachment Details

GetTime function leaving out leading 0 in minutes

Asked by bjv211 in JavaScript

Tags: gettime, function

I am grabbing system time with the following code, hwoever, if a time is before 10 minutes (ie 4:09) the output is 4:9.  any thoughts?

function GetTime(){
   var d, s = "";
   var c = ":";
   d = new Date();
   s += d.getHours() + c;
   s += d.getMinutes();
   document.getElementById("time").value = s;
}Start Free Trial
[+][-]11.04.2005 at 02:29PM PST, ID: 15228447

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: gettime, function
Sign Up Now!
Solution Provided By: Zvonko
Participating Experts: 1
Solution Grade: A
 
 
[+][-]11.04.2005 at 02:49PM PST, ID: 15228602

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.10.2005 at 07:44AM PST, ID: 15266146

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.10.2005 at 09:55AM PST, ID: 15267549

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32