title: Is there a library function that can give me the current date in variables and find the number of days passed since a given date
body: <p>I want to get the current date and time the variables </p>
  
  <pre><code> int d,m,y,h,s;
  </code></pre>
  
  <p>So far I have made a class for Date that could let the user enter the date and it checks for the validity of the date but I am not sure how to get the number of days passed since and also the current date.</p>
  
  <p>My class Date -></p>
  
  <pre><code>import ShortHand.*;
  public class Date {
      public static char[] digits={'0','1','2','3','4','5','6','7','8','9'};
      int d=0,m=0,y=0;
      public int getD() {
          return d;
      }
      public int getM() {
          return m;
      }
      public int getY() {
          return y;
      }
      public Date(int dd,int mm,int yy)
      {
          if (checkDate(dd,mm,yy)==false)
              throw new IllegalArgumentException("Invalid Date");
          this.d=dd;
          this.m=mm;
          this.y=yy;
      }   
      public static boolean checkDate(int d,int m,int y)
      {
          if (m&lt;1||d&lt;1||y&lt;1)
              return false;
          if (m&gt;12)
              return false;
          if (m==2&amp;&amp;checkLeap(y)&amp;&amp;d&gt;29)
              return false;
          if (m==2&amp;&amp;!(checkLeap(y))&amp;&amp;m&gt;28)
              return false;
          if ((m==1||m==3||m==5||m==7||m==8||m==10||m==12)&amp;&amp;d&gt;31)
              return false;
          if ((m==4||m==6||m==8||m==11)&amp;&amp;d&gt;30)
              return false;
          return true;
      }
      public static boolean checkLeap(int y)
      {
          if (y%100!=0)
          {
              if (y%4==0)
                  return true;
          }
          else if (y%400==0)
              return true;
          return false;
      }
      public static Date takeIn(String msg)throws java.io.IOException
      {
          int d,m,y;
          while(true)
          {
              boolean f=true;
              u.pln(msg+"[dd-mm-yyyy]");
              String in=u.iBs();
              if (in.length()!=10)
              {
                  u.pln("Please Enter a Valid Date");
                  continue;
              }
              for (int i=0;i&lt;10;i++)
              {
                  if (i!=2&amp;&amp;i!=5)
                  {
                      if (Arr.check(in.charAt(i), digits)==false)
                      {
                          u.pln("Invalid Input");
                          f=false;
                          break;
                      }
                  }
              }
              if (f==false)
                  continue;
              String t=in.substring(0,2);
              d=Integer.parseInt(t);
              t=in.substring(3,5);
              m=Integer.parseInt(t);
              t=in.substring(6);
              y=Integer.parseInt(t);
              if (checkDate(d,m,y))
                  break;
          }
          return new Date(d,m,y);
      }
      @Override
      public String toString() {
          return this.d+"/"+this.m+"/"+this.y;
      }
      @Override
      public boolean equals(Object obj) {
          if (this == obj) {
              return true;
          }
          if (obj == null) {
              return false;
          }
          if (getClass() != obj.getClass()) {
              return false;
          }
          Date other = (Date) obj;
          if (d != other.d) {
              return false;
          }
          if (m != other.m) {
              return false;
          }
          if (y != other.y) {
              return false;
          }
          return true;
      }
  }
  </code></pre>