Sharepoint : Changing date format using javascript

I would recommend to use : Moment.js library (link)

Format Dates

moment().format('MMMM Do YYYY, h:mm:ss a'); // December 6th 2018, 11:55:15 am
moment().format('dddd');                    // Thursday
moment().format("MMM Do YY");               // Dec 6th 18
moment().format('YYYY [escaped] YYYY');     // 2018 escaped 2018
moment().format();                          // 2018-12-06T11:55:15+01:00

Relative Time

moment("20111031", "YYYYMMDD").fromNow(); // 7 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 6 years ago
moment().startOf('day').fromNow();        // 12 hours ago
moment().endOf('day').fromNow();          // in 12 hours
moment().startOf('hour').fromNow();       // an hour ago

===============================================
https://msdn.microsoft.com/fr-fr/library/ee532932(v=vs.94).aspx

var myDate = new Date("1/1/1990")
myDate.setMonth(myDate.getMonth() + 1);

myDate.setDate (myDate.getDate() - 1);

document.write(myDate);

// Output: Wed Jan 31 00:00:00 PST 1990
===========================================================
var today = new Date(new Date().setHours(0,0,0,0));

extradrmtech

Since 30 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions and medias protecting solutions. I am experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. Besides my work, I like to work freelance only on some wordpress projects because it is relaxing and delightful CMS for me. When not working, I like to dance salsa and swing and to have fun with my little family.

You may also like...