Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

simple date format

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test {
   public static void main(String args[]) throws ParseException {  
       String date_string = "26-09-1989";
       //Instantiating the SimpleDateFormat class
       SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");      
       //Parsing the given String to Date object
       Date date = formatter.parse(date_string);      
       System.out.println("Date value: "+date);
   }
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #simple #date #format
ADD COMMENT
Topic
Name
6+2 =