Skip to content

Commit

Permalink
Update DateTime.html
Browse files Browse the repository at this point in the history
  • Loading branch information
lixinso committed Oct 27, 2021
1 parent 6ba59c8 commit 1551649
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions DateTime/DateTime.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@

<script>

function formateDate(dt){
function formateDate(dtstr){

var dt = new Date(dtstr);

const months = ["Jan", "Feb", "Mar","Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
let formatted_date = months[dt.getMonth()] + " " + dt.getDate() + ", " + dt.getFullYear()
console.log(formatted_date)
return formatted_date;
}


let current_datetime = new Date();
console.log(current_datetime.toString())

var result = formateDate(current_datetime);
var result = formateDate("2021-09-08T05:29:52.867");

alert(result);

Expand Down

0 comments on commit 1551649

Please sign in to comment.