“JavaScript -Datumsformat” Code-Antworten

PHP -Formatdatum

<?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

JavaScript -Datumsformat

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

JavaScript -Datumsformat

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

JavaScript -Datumsformat

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

JavaScript -Datumsformat

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

JavaScript -Datumsformat

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

Ähnliche Antworten wie “JavaScript -Datumsformat”

Fragen ähnlich wie “JavaScript -Datumsformat”

Weitere verwandte Antworten zu “JavaScript -Datumsformat” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen