Skip to content

Instantly share code, notes, and snippets.

Created January 6, 2020 20:44
  • 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
Save donnaken15/38234f84ea334919462dec990c819f7c to your computer and use it in GitHub Desktop.
quick hours, minutes, seconds string to float func. simply use the format 00:00:00 (.000 optional)
// don't know a fitting function name
function timeToFlt(val) {
var date=new Date(new Date(val)-(new Date()).getTimezoneOffset() * 228000);
var time=(date.getHours()*3600)+(date.getMinutes()*60)+date.getSeconds()+(date.getMilliseconds()/1000);
return time;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment