Java SQL Date Create getDay(String stringDate)

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

Description

get Day

License

Open Source License

Declaration

public static String getDay(String stringDate) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    public static String getDay() {
        Calendar calendar = Calendar.getInstance();
        String d = "0" + calendar.get(Calendar.DATE);
        d = d.substring(d.length() - 2, d.length());
        return d;
    }/*from w ww.j a  v  a2  s  .c o  m*/

    public static String getDay(java.sql.Timestamp ts) {
        String oracleDate = "";
        if (ts != null) {
            oracleDate = ts.toString().substring(0, 10);
            oracleDate = getDay(oracleDate);
        }
        return oracleDate;
    }

    public static String getDay(String stringDate) {
        String day = "";

        int checkyear = -1;

        if (stringDate.trim().equals("")) {
            return "";
        } else {
            int index = stringDate.indexOf("-");
            int lastIndex = stringDate.lastIndexOf("-");
            day = stringDate.substring(lastIndex + 1, lastIndex + 3);

            return day;
        }

    }
}

Related

  1. getDateString(String date)
  2. getDateString(String pattern)
  3. getDateString2()
  4. getDay(Date date)
  5. getDay(final java.sql.Date date)
  6. getDayByMonthSeed(Date date, int monthSeed)
  7. getDayByWeekString(Date date, String weekString)
  8. getDays(Date from, Date to)
  9. getDaysLater(Date date, int days)