title: Storing multiple variables into one variable - Java
body: <p>So I am having trouble assigning multiple variables to one variable.</p>
  
  <p>I have a date picker and time picker in my application and the values that the user picks are stored as separate variables. I then want to take all of the variables and assign them to one variable so I can store the users input and use it publicly in other activities.</p>
  
  <p>EDIT:
  so I am working with a third party library that uses animated graphs and to generate the graph I must pass through integers. So after trying out all your suggestions this it is working using the Gregorian way:</p>
  
  <pre><code>timeselected = new GregorianCalendar(yearNow, monthNow, dayNow, hourNow, minuteNow).getTime();
  </code></pre>
  
  <p>Only thing now is this is stored as a date and cannot be cast to an integer??</p>
  
  <p>For example, here is what I have tried so far:</p>
  
  <p>The variables that I use to store the picker selection are:</p>
  
  <pre><code> int dayNow, monthNow, yearNow, hourNow, minuteNow;
  </code></pre>
  
  <p>I have tried to assign them to one variable like so:</p>
  
  <pre><code>timeselected = (yearNow) + (monthNow) + (dayNow) + (hourNow) + (minuteNow);
  </code></pre>
  
  <p>Although this is giving me a total of all the variables added up. e.g. year(2017) plus month(11) etc.</p>
  
  <p>Does anyone know how I can get this to store the selected data (which should be a date format) as an Integer?</p>
  
  <p>Thanks</p>