Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get the current date time in javascript in 12 hour format

//this will give you date object remove the outer new Date to have 
//it as string
const today = new Date(new Date().toLocaleString("en-US", {
    day: '2-digit',
    month: '2-digit',
    year: 'numeric',
    hour: '2-digit',
    minute: '2-digit',
    second: '2-digit',
    hour12: true
}));
Comment

how to conver time format to 12 hours in javascript

var hours = dt.getHours()
minute = dt.getMinutes();
hours = (hours % 12) || 12;
console.log("Time is - " + hours + ":" + minure;
Comment

PREVIOUS NEXT
Code Example
Javascript :: get current screen name react navigation 
Javascript :: mongoose generate new ObjectID 
Javascript :: add keyup event javascript 
Javascript :: .map for object javscript 
Javascript :: quotient js 
Javascript :: node run parameters 
Javascript :: change icon sapui5 
Javascript :: play store rejected app due non-certified ads SDK 
Javascript :: exponent form calculator in angular 
Javascript :: hover vanilla javascript 
Javascript :: js random int 
Javascript :: for loop array javascript 
Javascript :: character to ascii javascript 
Javascript :: javascript check if number is even or odd 
Javascript :: js get meta content 
Javascript :: try catch in javascript 
Javascript :: appTsConfig.compilerOptions[option] = value; 
Javascript :: is intersectionobserver supported in browser 
Javascript :: scroll to bottom of an element react 
Javascript :: string contains in react 
Javascript :: javascript scroll to bottom of div 
Javascript :: add and remove checked jquery 
Javascript :: does json only support ascii 
Javascript :: react index.js BrowserRouter 
Javascript :: react jsx style with calc 
Javascript :: how to setItem and getItem in javascript in localStorage 
Javascript :: how to read a firebase txt file 
Javascript :: react absolute import 
Javascript :: jquery on enter click 
Javascript :: react native get route name 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =