Java - SimpleDateFormat


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import java.text.SimpleDateFormat;
  2.  
  3. import java.util.Date;
  4.  
  5. public class JavaSimpleDateFormatExample{
  6.  
  7. public static void main(String args[]){
  8.  
  9. Date date = new Date();
  10.  
  11. String DATE_FORMAT = "MM/dd/yyyy";
  12.  
  13. SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
  14.  
  15. System.out.println("Today is " + sdf.format(date) );
  16.  
  17. }
  18.  
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.