javascript date to string
// There are two flavours
const event = new Date(1993, 6, 28, 14, 39, 7);
// The Old Skool Flava
console.log(event.toString());
// expected output: Wed Jul 28 1993 14:39:07 GMT+0200 (CEST)
// (note: your timezone may vary)
// The Hipster way ;)
console.log(event.toDateString());
// expected output: Wed Jul 28 1993var d = new Date();
var n = d.toDateString();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));
Also in JavaScript:
- format money javascript commas
- how to run a vue js hello world app in vue version 3
- javascript validate email
- for each array javascript
- JS exercise bank account constructor functions and prototypes solution
- package json proxy
- node js http request get parameters
- simple alert program in javascript
- add webpack to react project tutorial
- javascript test login password in bootstrap studio
- getting the value of pi in javascript
- javascript insertBefore
- how do i backspace from javascript calculator
- javascript select input text on focus
- Unterminated quote at columns 0-8 ['MM-yyyy] in expression ['MM-yyyy]
- .remove javascript
- how to use componentdidmount in functional component
- for in and for of in js
- check if localstorage key exists js
- react documentation
- javascript modal show
- how to update firebase document field angular
- js add week to date
- node js to check 32 bit