Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript date to string format

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
Comment

js date into format

var date = new Date('1970-01-01'); // Or your date here
console.log((date.getMonth() + 1) + '/' + date.getDate() + '/' +  date.getFullYear());
Comment

date to string format javascript

var today = new Date();
today.toISOString().substring(0, 10);
Comment

date to string format javascript

function formatDate(date) {
    var d = new Date(date),
        month = '' + (d.getMonth() + 1),
        day = '' + d.getDate(),
        year = d.getFullYear();

    if (month.length < 2) 
        month = '0' + month;
    if (day.length < 2) 
        day = '0' + day;

    return [year, month, day].join('-');
}
 
console.log(formatDate('Sun May 11,2014'));
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to get value inside span using javascript 
Javascript :: why navlink in react router always active 
Javascript :: js concatenate strings 
Javascript :: prepen an element js 
Javascript :: nodejs s3 list objects from folder 
Javascript :: C# Convert Json File to DataTable 
Javascript :: AJAX JAVASCRIPT FUNCTION CALLS 
Javascript :: How to pass data in Link of react-router-dom 
Javascript :: redux toolkit store 
Javascript :: jsonb_set 
Javascript :: peerjs 
Javascript :: big o notation javascript 
Javascript :: vue nested loop 
Javascript :: js knex migration 
Javascript :: document.queryselector 
Javascript :: iteratea on values map js 
Javascript :: run node script pupeeter when button from form clicked 
Javascript :: new date 
Javascript :: javascript debugger online 
Javascript :: how to append data to a form data in javascript 
Javascript :: find object in array 
Javascript :: how to clear a function in javascript 
Javascript :: how to use cookies in react class component 
Javascript :: how to add two times in javascript 
Javascript :: ${ js 
Javascript :: print() in javascript 
Javascript :: how to style navigation drawer react navigation v5 
Javascript :: passing multiple props to child component in react 
Javascript :: Remove duplicates from arrays using reduce 
Javascript :: Iterate Through the Keys of an Object 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =