Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created February 14, 2017 12:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
var jsonData = {from: Dateオブジェクト, to:Dateオブジェクト}
var res = JSON.stringify(jsonData, function(key, val){
if (key === "from" || key === "to") {
return moment(new Date(val)).format('YYYY/MM/DD HH:mm:ss');
}
return val;
}, "\t");
※5行目のformatで時間の部分は"HH"大文字2桁にすることで24時間形式になります
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment