“Data JavaScript” Respostas de código

JavaScript Obtenha horário atual

var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
Lonely Loris

Javascript Data Hora

//Date, Time, Timestamp
var today = new Date();
var DD = String(today.getDate()).padStart(2, '0');
var MM = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var YYYY = today.getFullYear();
var hh = today.getHours();
var mm = today.getMinutes();
var ss = today.getSeconds();
today = YYYY + MM + DD + hh + mm + ss;
console.log('Date-Time: ', today);
Jedi

Data Hora JS

//Do you need the current time ? ⌚
let date = new Date();
let time = ((date.getHours().toString()).length>1? date.getHours() : "0"+date.getHours()) +":"+ ((date.getMinutes().toString()).length>1? date.getMinutes() : "0"+date.getMinutes());
//If 4h-2min => 04:02
//If 20h-15min => 20:15
Nekå

Data JavaScript

let mdy = ['month', 'date', 'year'];
let hms = ['hour', 'minute', 'second'];
mdy = new Date().toLocaleDateString("en-US").split("/");
hms = new Date().toLocaleTimeString("en-US").split(/:| /);
console.log(mdy,hms);
Graceful Gharial

Data JavaScript

var d= new Date();  // generate today's DATE
console.log (d);

var s= new Date ("2020-09-15"); // generate the specific DATE:spetember 9 2020
var y=new Date().getFullYear(); // generate the year of specific DATE
var m=new Date().getMonth(); // generate the month of specific DATE
var d=new Date().getDay(); // generate the day of specific DATE
var D=new Date().getDate(); // generate  the specific DATE
The Code Slayer

Data JavaScript

const regexDate = /^\d{2}\/\d{2}\/\d{4}$/
Lonely Lyrebird

Respostas semelhantes a “Data JavaScript”

Perguntas semelhantes a “Data JavaScript”

Mais respostas relacionadas para “Data JavaScript” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código