2012-01-25 3 views

答えて

2

ためAsia/Calcultta

EDITのビットハック:私はそれを試してみました

SimpleDateFormat sdfDate = new SimpleDateFormat("dd.MM.yyyy"); 
      java.util.Date date = new java.util.Date(); 
      String strDate = sdfDate.format(date); 

:また、あなたのコード内でthis

public class Foo { 
    public static void main(String[] args) throws Exception { 
     String date = "Wed Jan 18 08:50:04 Asia/Calcutta 2012"; 
     System.out.println(formatDate(date)); 
    } 

    private static String formatDate(String date) throws Exception { 
     String year = date.substring(date.lastIndexOf(' ') + 1); 
     DateFormat sdf = new SimpleDateFormat("EEE MMM dd kk:mm:ss"); 
     SimpleDateFormat fmt = new SimpleDateFormat(String.format("dd.MM.%s", 
                    year)); 
     Date parse = sdf.parse(date); 
     return fmt.format(parse); 
    } 
} 
0

てみてくださいを見つけました。

関連する問題