Java Day From getDay(String date)

Here you can find the source of getDay(String date)

Description

get Day

License

Open Source License

Declaration

public static int getDay(String date) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {
    public static int getDay(String date) {
        date = deleteSlash(date);//  www  .j  av a  2  s.  c  o  m
        date = deleteDash(date);
        return Integer.parseInt(date.substring(6, 8));
    }

    public static String deleteSlash(String value) {
        return deleteChar(value, "/");
    }

    public static String deleteDash(String value) {

        return deleteChar(value, "-");
    }

    public static String deleteChar(String source, String deleteStr) {
        if (source == null || "".equals(source.trim())) {
            return "";
        }
        StringBuffer temp = new StringBuffer("");
        StringTokenizer st = new StringTokenizer(source, deleteStr);

        while (st.hasMoreTokens()) {
            temp.append(st.nextToken());
        }

        return temp.toString();
    }
}

Related

  1. getDateFromDayNum(int dayNum)
  2. getDateUpDay(Date d)
  3. getDay(Date date)
  4. getDay(Date date)
  5. getDay(Date date, int day)
  6. getDay0(Date date)
  7. getDayOfDate(Date date)
  8. getDays(Date date1, Date date2)
  9. getDays(Date sd, Date ed)