Announcement

Collapse
No announcement yet.

how to: use 2 digit minutes and seconds in 'get date' button

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to: use 2 digit minutes and seconds in 'get date' button

    I've noticed that when you hit the 'get date' button for the time and date of last attempt (and probably any time & date field), if the minutes or seconds are single digit numbers, it displays them as single digits in the time field. Here's how to get them to always display two digits for those fields:


    var CurrMinutes = CurrTime.getMinutes();
    var CurrSeconds = CurrTime.getSeconds();
    if ( CurrMinutes < 10)
    CurrMinutes = "0" + CurrMinutes;
    if (CurrSeconds < 10)
    CurrSeconds = "0" + CurrSeconds;
    document.TLForm.elements.TL_LASTATTEMPTTIME_EDIT.v alue = CurrTime.getHours()+":"+CurrMinutes+":"+CurrSecond s;

    This is for time & date of last attempt (hence the .TL_LASTATTEMPTTIME_EDIT in the last line) but can be easily modified to fit into any date & time field.
Working...
X