zoukankan      html  css  js  c++  java
  • android 获取日期





    */ public static HashMap<String, String> computeDate(){ Calendar cal =Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); HashMap<String, String> map = new HashMap<String, String>(); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); //获取本周一的日期 // System.out.println(df.format(cal.getTime())); map.put("MONDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); //获取本周二的日期 // System.out.println(df.format(cal.getTime())); map.put("TUESDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); //获取本周三的日期 // System.out.println(df.format(cal.getTime())); map.put("WEDNESDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); //获取本周四的日期 // System.out.println(df.format(cal.getTime())); map.put("THURSDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); //获取本周五的日期 // System.out.println(df.format(cal.getTime())); map.put("FRIDAY", df.format(cal.getTime())); cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); //获取本周六的日期 // System.out.println(df.format(cal.getTime())); map.put("SATURDAY", df.format(cal.getTime())); //这种输出的是上个星期周日的日期,因为老外那边把周日当成第一天 cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); //增加一个星期,才是我们中国人理解的本周日的日期 cal.add(Calendar.WEEK_OF_YEAR, 1); // System.out.println(df.format(cal.getTime())); map.put("SUNDAY", df.format(cal.getTime())); return map; }

      

  • 相关阅读:
    系统操作日志设计代码实现
    SQL SERVER 存储过程复习
    IGrab信息采集系统流程图(初稿)
    收藏几段SQL语句和存储过程
    SQL Server联机丛书:存储过程及其创建
    使用dynamic来简化反射实现,并且提高了性能
    你必须知道的C#的25个基础概念(附演示)
    弹窗插件
    dede 搜索时出现“SphinxClient类找不到”解决
    开启includes模块运行shtml
  • 原文地址:https://www.cnblogs.com/tefcricul/p/3667915.html
Copyright © 2011-2022 走看看