title: Java Epoch Date for Google SpreadSheet
body: <p>I tried to add date on Google spreadsheet. To add date we have convert date in epoch.</p>
  
  <p>For Spreadsheet epoch </p>
  
  <p>Google Sheets uses a form of epoch date that is commonly used in spreadsheets. The whole number portion of the value (left of the decimal) counts the days since December 30th 1899. The fractional portion (right of the decimal) counts the time as a fraction of one day. For example, January 1st 1900 at noon would be 2.5, 2 because it's two days after December 30th, 1899, and .5 because noon is half a day. February 1st 1900 at 3pm would be 33.625.</p>
  
  <p>We uses Joda time API for calculation.(Our JDK version 1.7). </p>
  
  <p>For Whole number we uses below code.</p>
  
  <pre><code>public static double getEpochDate(Date inputDate)
  {
  
      MutableDateTime epoch = new MutableDateTime();
      epoch.setTime(0, 0, 0, 0);
      epoch.setDate(1899,12,30); //Set to Epoch time
      System.out.println(epoch);
      DateTime now = new DateTime(inputDate);
      Days days = Days.daysBetween(epoch, now);
  
  
      return Double.valueOf(days.getDays());
  }
  </code></pre>
  
  <p>We are facing issue to find faction part of epoch number </p>