zoukankan      html  css  js  c++  java
  • 显示当前日期时间

     1  private String getCurrentDate() {
     2         final Calendar c = Calendar.getInstance();
     3         c.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
     4         String mYear = String.valueOf(c.get(Calendar.YEAR)); // 获取当前年份
     5         String mMonth = String.valueOf(c.get(Calendar.MONTH) + 1);// 获取当前月份
     6         String mDay = String.valueOf(c.get(Calendar.DAY_OF_MONTH));// 获取当前月份的日期号码
     7         String mWay = String.valueOf(c.get(Calendar.DAY_OF_WEEK));
     8 
     9         if ("1".equals(mWay)) {
    10             mWay = "天";
    11         } else if ("2".equals(mWay)) {
    12             mWay = "一";
    13         } else if ("3".equals(mWay)) {
    14             mWay = "二";
    15         } else if ("4".equals(mWay)) {
    16             mWay = "三";
    17         } else if ("5".equals(mWay)) {
    18             mWay = "四";
    19         } else if ("6".equals(mWay)) {
    20             mWay = "五";
    21         } else if ("7".equals(mWay)) {
    22             mWay = "六";
    23         }
    24         return mYear + "年" + mMonth + "月" + mDay + "日" + " 星期" + mWay;
    25     }
  • 相关阅读:
    java内部类
    unityUI拖拽
    Java泛型
    java集合
    python爬取糗百段子
    python读取文件并保存到mysql数据库
    BeanShell Sampler 身份证号-jmeter
    python操作数据库
    创建身份证号
    随机生成四要素
  • 原文地址:https://www.cnblogs.com/cbx17v/p/7089989.html
Copyright © 2011-2022 走看看