Answers for "date string"

PHP
13

format date js

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

 // For custom format use
 date.toLocaleDateString("en-US", { day: 'numeric' })+ "-"+ date.toLocaleDateString("en-US", { month: 'short' })+ "-" + date.toLocaleDateString("en-US", { year: 'numeric' }) // 16-Nov-2019
Posted by: Guest on November-02-2020
4

parse date from string in js

Date.parse(dateString)
//dateString is like 2020-10-10 / 2020-10-10T10:20:20
Posted by: Guest on October-23-2020
1

javascript date format

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}`)
Posted by: Guest on May-31-2020
0

date string

date("d/M/Y", strtotime("2011/02/01"));
Posted by: Guest on October-02-2021
1

javascript full date as string

<p>The toDateString() method converts a date to a date string:</p>

<p id="demo"></p>

<script>
var d = new Date();
document.getElementById("demo").innerHTML = d.toDateString();
</script>
//output: Fri Oct 16 2020
Posted by: Guest on October-16-2020
0

javascript date parse yyyy-mm-dd

var dateString = "10/23/2015"; // Oct 23

var dateObject = new Date(dateString);

document.body.innerHTML = dateObject.toString();
Posted by: Guest on November-05-2020

Browse Popular Code Answers by Language