如果告诉我用数字判断,那你自己去面壁

解决方案 »

  1.   

    Date date = new Date();
            SimpleDateFormat format = new SimpleDateFormat("MMM");
            
            System.out.println(format.format(date));前提是你的机器的地域为英语国家
      

  2.   

    public SimpleDateFormat(String pattern,
                            Locale locale)
    Date date = new Date();
            SimpleDateFormat format = new SimpleDateFormat("MMM",Local.US);
    这样就该了区域了!
      

  3.   

    不错用Locale:
    SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMMMdd", Locale.US);
    System.out.println(format2.format(date));
    楼上的Local.US写错了。
      

  4.   

    楼上的没有错.也可以用Calendar
      

  5.   

    MMM 与 MMMM 是有区别的:一个是缩写一个是全称。
    这里要用MMMM。
      

  6.   

    import java.util.*;
    import java.text.*;
    public class GetMonthOfDate
    {
    public static void main(String[] args)
    {
    Date d=new Date();
    SimpleDateFormat sdf=new SimpleDateFormat("MMM",Locale.US);
    System.out.println(sdf.format(d));
    }
    }