diff --git a/snippets/json-to-date.md b/snippets/json-to-date.md new file mode 100644 index 000000000..7e5efcdc7 --- /dev/null +++ b/snippets/json-to-date.md @@ -0,0 +1,12 @@ +### JSON to date + + + ```js +cconst JsonToDate = arr => + { + const dt = new Date(parseInt(arr.toString().substr(6))); + return dt.getDate() + '/' + dt.getMonth() + '/' + dt.getFullYear(); + }; + // JsonToDate(/Date(1489525200000)/) -> 15/2/2017 + ``` +