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 :: month name array javascript 
Javascript :: how to make javascript make things disappear 
Javascript :: how to store words in an array in javascript 
Javascript :: Codewars Beginner - Reduce but Grow 
Javascript :: fullscreen mode javascript 
Javascript :: change onclick attribute javascript 
Javascript :: keyup multiple fields 
Javascript :: mui textfield font color 
Javascript :: class MyComponent extends React.Component { } ... what is the ES5 equivalent of this * 
Javascript :: write files in node js 
Javascript :: how to trigger events when the document loads in js 
Javascript :: json post fetch 
Javascript :: how to call a javascript function in html without any event 
Javascript :: change hover css javascript 
Javascript :: How to Check for a Null or Empty String in JavaScript 
Javascript :: div outside click event jquery 
Javascript :: conditionally set checkbox state in React 
Javascript :: fizzbuzz js 
Javascript :: self invoking function javascript es6 
Javascript :: js on edge files 
Javascript :: protractor get active element 
Javascript :: convert responsetext to json python 
Javascript :: Javascript case insensitive string comparison 
Javascript :: simple AES encryption javascript 
Javascript :: jquery loop through class inside the div 
Javascript :: insertone mongoose 
Javascript :: js get website short name 
Javascript :: where to put js files in flask 
Javascript :: remove sliding animation from owl carousel 
Javascript :: javascript set date to timezone 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =