title: Node.js Storing Current Date as Epoch Value
body: <p>I know there are many questions relative to this, but I can't find exactly what I am looking for..</p>
  
  <p>I am creating an iOS Rideshare app and am utilizing the Google Distance Matrix. What I am looking to do is taking the current date and set it to midnight. For example: <code>currentDate = 12/6/2018 12:00:00</code>.</p>
  
  <p>I want to take this <code>currentDate</code> value and convert is to Epoch and set it up as a <code>baseEpoch</code> value. This way, I can take the user's time input, and add the difference to get the date/time they entered in Epoch form.</p>
  
  <p>I've tried solutions such as:</p>
  
  <pre><code>function convertToEpoch(time)
  {
    var sep = time.split(':');
    var seconds = (+sep[0]) * 60 * 60 + (+sep[1]) * 60 + (+sep[2]);
    return seconds;
  }
  
  function currentDateAsEpoch(time) {
    var time = new Date();
    time.setHours(0,0,0,0);
  
    convertToEpoch(time);
  }
  
  const baseEpoch = currentDateAsEpoch();
  </code></pre>
  
  <p>But am getting the error: <code>TypeError: time.split is not a function</code></p>
  
  <p>I want the <code>baseEpoch</code> to be set as the current date so Google Distance Matrix doesn't return the <code>departure_time</code> error saying time can only be equal to or in the future.</p>
  
  <p>Thank you in advance for your help!</p>