Search This Blog

Friday, 2 March 2012

program to change date format

import java.util.Scanner;
import java.util.*;
import java.text.*;


public class ScanInput {
   public static void main(String[] args)throws Exception {   
        Scanner scan = new Scanner(System.in);
        System.out.print("Enter the input");
        String userInput = scan.next();
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy")
        Date varDate=dateFormat.parse(userInput);
        System.out.print("parsed date is"+varDate);
}
}

No comments:

Post a Comment