Date to get day seconds and Milli seconds - Node.js Date

Node.js examples for Date:Second

Description

Date to get day seconds and Milli seconds

Demo Code

Date.prototype.getDaySeconds = function getDaySeconds() {
  return (this.getUTCHours()* 60 + this.getUTCMinutes())*60 + this.getUTCSeconds() + this.getUTCMilliseconds()/1000;
}

Date.prototype.getDaySimpleSeconds = function getDaySimpleSeconds() {
  return Math.floor(this.getDaySeconds()/ (24*60*60) * (10*100*100));
}

Date.prototype.getSimpleMilliseconds = function getSimpleMilliseconds() {
  return (this.getDaySeconds()/ (24*60*60) * (10*100*100)) - this.getDaySimpleSeconds();
}

Date.prototype.getSimpleSeconds = function getSimpleSeconds() {
  var ss_ofs = this.getDaySimpleSeconds();
  var sm_ofs = Math.floor(ss_ofs/100);
  var sh_ofs = Math.floor(sm_ofs/100);
  
  return ss_ofs - sm_ofs*100;
}

Related Tutorials