Search
 
SCRIPT & CODE EXAMPLE
 

HTML

am pm after the time in html

var inputEle = document.getElementById('timeInput');


function onTimeChange() {
  var timeSplit = inputEle.value.split(':'),
    hours,
    minutes,
    meridian;
  hours = timeSplit[0];
  minutes = timeSplit[1];
  if (hours > 12) {
    meridian = 'PM';
    hours -= 12;
  } else if (hours < 12) {
    meridian = 'AM';
    if (hours == 0) {
      hours = 12;
    }
  } else {
    meridian = 'PM';
  }
  alert(hours + ':' + minutes + ' ' + meridian);
}
Comment

PREVIOUS NEXT
Code Example
Html :: how to set image in input type=file by jquery 
Html :: free android apk 
Html :: equal symbol expected spring form 
Html :: app:lintVitalRelease output fir 
Html :: html path svg stop 
Html :: tailwind tag input 
Html :: html make a clickable link 
Html :: how to change the postion of text in html 
Html :: Rendering text in italics in HTML 
Html :: navratri 2020 
Html :: APP_ENV=testing 
Html :: html a tag not closing 
Html :: show html 
Html :: mobile width reads 980px ? 
Html :: select html gray safari 
Html :: typo3 news search form params lost pagination 
Html :: <a href="https://api.whatsapp.com/send?phone=15551234567"Send Message</a  
Html :: display sqlite text with jinja as HTML paragraph 
Html :: json to html 
Html :: nio aandelen 
Html :: arecanut plate price in dubai by sri lankan price 
Html :: chrome devtools filter exclude 
Html :: does redux has a unidirectional data flow? 
Html :: href root folder html 
Html :: uttwuuwudqtudutauutduatTDUaduatduituitdA 
Html :: Hyperlink in razor 
Html :: rovots.txt sitemap url 
Html :: scratch card HTML 
Html :: html setup 
Html :: posh-ssh key authentication 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =