Commit 2fb488386dace9c6dd03c09ffadaff01db88e0b0

Authored by jiangjiazhi
1 parent 4e8adbc40b

分娩作废产检劵

Showing 1 changed file with 18 additions and 88 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 2fb4883
... ... @@ -70,18 +70,30 @@
70 70 int year1 = c1.get(Calendar.YEAR);
71 71 int year2 = c2.get(Calendar.YEAR);
72 72  
73   - int mouth1 = c1.get(Calendar.MONTH);
74   - int mouth2 = c2.get(Calendar.MONTH);
  73 + int mouth1 = c1.get(Calendar.MONTH);//0当前
  74 + int mouth2 = c2.get(Calendar.MONTH);//4
75 75 int i=0;
76   - if(mouth2-mouth1>=0){
77   - int days1 = c1.get(Calendar.DAY_OF_MONTH);
78   - int days2 = c2.get(Calendar.DAY_OF_MONTH);
  76 + /* if(mouth2-mouth1>=0){
  77 + int days1 = c1.get(Calendar.DAY_OF_MONTH);//当前10
  78 + int days2 = c2.get(Calendar.DAY_OF_MONTH);//1
79 79 if(days1<days2){
80 80 i=i-1;
81 81 }else if(days1>days2){
82 82 }
83 83 }else if(mouth1-mouth2<0){
84 84 i=i-1;
  85 + }*/
  86 +
  87 + if(mouth2==mouth1){
  88 + int days1 = c1.get(Calendar.DAY_OF_MONTH);//当前10
  89 + int days2 = c2.get(Calendar.DAY_OF_MONTH);//1
  90 + if(days1<days2){
  91 + i=i-1;
  92 + }else if(days1>days2){
  93 +// i=i-1;
  94 + }
  95 + }else if(mouth2>mouth1){
  96 + i=i-1;
85 97 }
86 98  
87 99  
... ... @@ -766,89 +778,7 @@
766 778  
767 779  
768 780 public static void main(String[] arg) {
769   - /* Date today = new Date(1448336360000L);
770   -
771   - System.out.println(DateUtil.getyyyy_MM_dd_hms(today));
772   - System.out.println(today);
773   - System.out.println(getWeek(parseYMDHMS("2015-05-20 16:30:00"), parseYMDHMS("2015-12-22 11:30:00")));
774   - System.out.println(new DateTime().minusDays(77));*/
775   -// System.out.println(getDaySeconds());
776   -
777   -// String s = getBabyMonthAge(parseYMD("2015-08-12"), new Date());
778   -// System.out.println(s);
779   -// SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd ");
780   -// System.out.println(getBabyAgeMonth(parseYMD("2016-05-23"), new Date()));
781   -// System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.addDay(new Date(),-108)));
782   -// System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.addDay(new Date(), -146)));
783   -// System.out.print(1457688652-23341);
784   - //1457711993
785   -// 1426089600
786   -
787   -// Date lastLmess = parseYMD("2016-07-02");
788   -// Date startDate = DateUtil.getRangeDate(lastLmess, 1, "周", -2);
789   -// Date startDate = DateUtil.addDay(new Date(), -100);
790   -// System.out.println(getyyyy_MM_dd(startDate));
791   - try {
792   -
793   -// Date startDate = DateUtil.addMonth(new Date(), -1);
794   -// Date endtDate = DateUtil.addMonth(new Date(), -2);
795   -// System.out.println(y_m_d_h_m_s.format(startDate));
796   -// System.out.println(y_m_d_h_m_s.format(endtDate));
797   -
798   -// Date d = parseD("7");
799   -// System.out.print(getDD(d));
800   -
801   -// Date sendDate = dd.parse("02");
802   -// String md = DateUtil.getMMdd(new Date());
803   -// String str = md +"-"+DateUtil.getDD(sendDate);
804   -// Date d = DateUtil.parseYMD(str);
805   -//
806   -// Date actualSendDate = DateUtil.addDay(d, -2);
807   -// String sendDateStr = DateUtil.getDD(actualSendDate);
808   -
809   -// SimpleDateFormat md = new SimpleDateFormat("M-d");
810   -// String st = md.format(new Date());
811   -// System.out.print(st);
812   -
813   -// int s = getBabyMonthAge1(parseYMD("2016-09-07"), new Date());
814   -// System.out.println(s);
815   -// Date s = addDay(parseYMD("2016-02-26"), 168);
816   -
817   -// int start = 38;
818   -// int end = 38;
819   -////
820   -////
821   -//// Date startDate = DateUtil.getNewDate(-end-1,"周",1+1);
822   -//// Date endDate = DateUtil.getNewDate(-start,"周",0+1);
823   -//
824   -//
825   -// Date startDate = DateUtil.getNewDate(-end-1,"周",2+1);
826   -// Date endDate = DateUtil.getNewDate(-start,"周",2);
827   -//
828   -//
829   -// String date = y_m_d_h_m_s.format(startDate.getTime());
830   -//// Date startDate = DateUtil.getNewDate(-end-1,"月",1);
831   -//// Date endDate = DateUtil.getNewDate(-start,"月",1);
832   -//
833   -// System.out.println(date + "===");
834   -
835   -
836   -// Date startDate = getRangeDate(parseYMD("2016-09-07"),2,"周",-1);
837   -// System.out.println(getyyyy_MM_dd(startDate));
838   -
839   -
840   - int a = getBabyAgeMonth(parseYMD("2012-10-01"),parseYMD("2016-10-01"));
841   -// int a = daysBetween(parseYMD("2016-10-01"),new Date())/7;
842   - System.out.println(a);
843   -
844   -// Date dueDate = DateUtil.addDay(DateUtil.addMonth(parseYMD("2016-02-08"), 9), 7);
845   -// System.out.println(getyyyy_MM_dd(dueDate));
846   - } catch (Exception e)
847   - {
848   -
849   - }
850   -
851   -
  781 + System.out.println(getAge(parseYMD("1990-01-9")));
852 782 }
853 783  
854 784 /**