Skip to content

Instantly share code, notes, and snippets.

@muramoto1041
Created June 3, 2018 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muramoto1041/645590fa34d403f4efc0f7fc8012ff23 to your computer and use it in GitHub Desktop.
Save muramoto1041/645590fa34d403f4efc0f7fc8012ff23 to your computer and use it in GitHub Desktop.
JavaScript Object
Dim cd As String
cd = ""
cd = cd & "function timeConv(s){"
cd = cd & " var dt = new Date(s);"
cd = cd & " var dtf = dt.getFullYear();"
cd = cd & " dtf += '/' + (dt.getMonth()+1);"
cd = cd & " dtf += '/' + dt.getDate();"
cd = cd & " dtf += ' ' + dt.getHours();"
cd = cd & " dtf += ':' + dt.getMinutes();"
cd = cd & " dtf += ':' + dt.getSeconds();"
cd = cd & " return(dtf);"
cd = cd & "}"
js.Addcode cd
MsgBox js.CodeObject.timeConv(Range("b3"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment