title: Java: Get week number from any date?
body: <p>I have a small program that displays the current week from todays date, like this:</p>
  
  <pre><code>GregorianCalendar gc = new GregorianCalendar();
  int day = 0;
  gc.add(Calendar.DATE, day);
  </code></pre>
  
  <p>And then a JLabel that displays the week number:</p>
  
  <pre><code>JLabel week = new JLabel("Week " + gc.get(Calendar.WEEK_OF_YEAR));
  </code></pre>
  
  <p>So right now I'd like to have a JTextField where you can enter a date and the JLabel will update with the week number of that date. I'm really not sure how to do this as I'm quite new to Java. Do I need to save the input as a String? An integer? And what format would it have to be (yyyyMMdd etc)? If anyone could help me out I'd appreciate it!</p>