“format de date javascript” Réponses codées

Date de format PHP

<?php
  // To change the format of an existing date
  $old_date_format = "20/03/1999";
  $new_data_format = date("Y-m-d H:i:s", strtotime($old_date_format));
Xenophobic Xenomorph

format de date javascript

var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var today  = new Date();

console.log(today.toLocaleDateString("en-US")); // 9/17/2016
console.log(today.toLocaleDateString("en-US", options)); // Saturday, September 17, 2016
console.log(today.toLocaleDateString("hi-IN", options)); // शनिवार, 17 सितंबर 2016
Spongey Bob

Format de date javascript

new Date().toDateString();
//"Fri Jul 02 2021"
Amr Wafa

format de date javascript

const d = new Date('2010-08-05')
const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d)
const mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(d)
const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d)

console.log(`${da}-${mo}-${ye}`)
Panicky Panda

format de date javascript

function getDate(date) {
  let mydate = new Date(date);
  let day = mydate.getDate()
  let month = ["Januari", "Februari", "Maret", "April", "Mei", "Juni",
	"Juli", "Agustus", "September", "Oktober", "November", "Desember"
    ][mydate.getMonth()];
  return day + ' ' + month + ' ' + mydate.getFullYear();
}
Lubis Vermilion

format de date javascript

Modern JavaScript date utility library https://date-fns.org/
date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
Monkey Monk

Réponses similaires à “format de date javascript”

Questions similaires à “format de date javascript”

Plus de réponses similaires à “format de date javascript” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code