CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2019-04-22
by Khurshid Ansari

Original Post

Original - Posted on 2010-08-23
by Marko



            
Present in both answers; Present only in the new answer; Present only in the old answer;



<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
function formatDate(date) { var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
var day = date.getDate(); var monthIndex = date.getMonth(); var year = date.getFullYear();
return day + ' ' + monthNames[monthIndex] + ' ' + year; }
console.log(formatDate(new Date())); // show current date-time in console
<!-- end snippet -->

> Attention: There are better answers below. This answer was written in 2010 and newer and better solutions have arrived since. The OP should accept another answer.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
function formatDate(date) { var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
var day = date.getDate(); var monthIndex = date.getMonth(); var year = date.getFullYear();
return day + ' ' + monthNames[monthIndex] + ' ' + year; }
console.log(formatDate(new Date())); // show current date-time in console
<!-- end snippet -->
You can edit the array `monthNames` to use Jan, Feb, Mar, etc..

        
Present in both answers; Present only in the new answer; Present only in the old answer;