Android Day Get getDaySelect(String selectName, String value, boolean hasBlank, String js)

Here you can find the source of getDaySelect(String selectName, String value, boolean hasBlank, String js)

Description

get Day Select

License

Apache License

Declaration

public static String getDaySelect(String selectName, String value,
        boolean hasBlank, String js) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String getDaySelect(String selectName, String value,
            boolean hasBlank) {
        StringBuffer sb = new StringBuffer("");
        sb.append("<select name=\"" + selectName + "\">");
        if (hasBlank) {
            sb.append("<option value=\"\"></option>");
        }/*w  w w.j  a  v a  2 s . c o m*/
        for (int i = 1; i <= 31; i++) {
            if (!value.trim().equals("") && i == Integer.parseInt(value)) {
                sb.append("<option value=\"" + i + "\" selected>" + i
                        + "</option>");
            } else {
                sb.append("<option value=\"" + i + "\">" + i + "</option>");
            }
        }
        sb.append("</select>");
        return sb.toString();
    }

    public static String getDaySelect(String selectName, String value,
            boolean hasBlank, String js) {
        StringBuffer sb = new StringBuffer("");
        sb.append("<select name=\"" + selectName + "\" " + js + ">");
        if (hasBlank) {
            sb.append("<option value=\"\"></option>");
        }
        for (int i = 1; i <= 31; i++) {
            if (!value.trim().equals("") && i == Integer.parseInt(value)) {
                sb.append("<option value=\"" + i + "\" selected>" + i
                        + "</option>");
            } else {
                sb.append("<option value=\"" + i + "\">" + i + "</option>");
            }
        }
        sb.append("</select>");
        return sb.toString();
    }
}

Related

  1. getDayStartTime(long time)
  2. lastDay(Date date)
  3. firstDay(Date date)
  4. getDay(long dateTimeMillis)
  5. getDaySelect(String selectName, String value, boolean hasBlank)
  6. getCurrentDay()
  7. getSmartDateString(long time, String extString, String zeroDayString)
  8. getWeatherDateStr(int day)
  9. getArrayDiffDays(String startDate, String endDate)