當前位置: 首頁>>代碼示例>>Java>>正文


Java Calendar.AM屬性代碼示例

本文整理匯總了Java中java.util.Calendar.AM屬性的典型用法代碼示例。如果您正苦於以下問題:Java Calendar.AM屬性的具體用法?Java Calendar.AM怎麽用?Java Calendar.AM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.Calendar的用法示例。


在下文中一共展示了Calendar.AM屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateAmPmControl

private void updateAmPmControl() {
    if (is24Hour()) {
        if (mAmPmSpinner != null) {
            mAmPmSpinner.setVisibility(View.GONE);
        } else {
            mAmPmButton.setVisibility(View.GONE);
        }
    } else {
        int index = mIsAm ? Calendar.AM : Calendar.PM;
        if (mAmPmSpinner != null) {
            mAmPmSpinner.setValue(index);
            mAmPmSpinner.setVisibility(View.VISIBLE);
        } else {
            mAmPmButton.setText(mAmPmStrings[index]);
            mAmPmButton.setVisibility(View.VISIBLE);
        }
    }
    mDelegator.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
}
 
開發者ID:Gericop,項目名稱:DateTimePicker,代碼行數:19,代碼來源:TimePickerSpinnerDelegate.java

示例2: onTimeSet

@SuppressWarnings("WrongConstant")
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
    int hour, min;
    Calendar datetime = Calendar.getInstance();
    String am_pm = "" ;
    datetime.set(Calendar.HOUR_OF_DAY, hourOfDay);
    datetime.set(Calendar.MINUTE, minute);

    if (datetime.get(Calendar.AM_PM) == Calendar.AM)
        am_pm = "AM";
    else if (datetime.get(Calendar.AM_PM) == Calendar.PM)
        am_pm = "PM";
    hourOfDay = hourOfDay > 12 ? hourOfDay - 12 : hourOfDay;
    hour = hourOfDay > 9 ? hourOfDay : hourOfDay;
    min = minute > 9 ? minute : minute;
    timeInterface.setTime(hour, min, am_pm);
}
 
開發者ID:pawanchauhan05,項目名稱:AndroidUtility,代碼行數:17,代碼來源:AlertDialog.java

示例3: ItemEntity1

public ItemEntity1(String title, String content, int flag) {
    this.title = title;
    this.content = content;
    this.img = getImg(flag);
    long currentTimeMillis = System.currentTimeMillis();
    long timeMillis = currentTimeMillis - new Random().nextInt(1000 * 60 * 60 * 24 * 5);
    final Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(timeMillis);
    int time_flag = calendar.get(Calendar.AM_PM);
    this.time = (String) DateFormat.format("HH:mm", calendar);
    this.timeFlag = time_flag == Calendar.AM ? "AM" : "PM";
    this.id = TextUtils.isEmpty(title) ? currentTimeMillis : MD5Util.stringToMD5(title).hashCode();
}
 
開發者ID:crazysunj,項目名稱:MultiTypeRecyclerViewAdapter,代碼行數:13,代碼來源:ItemEntity1.java

示例4: getBeijingNowTimeString

public static String getBeijingNowTimeString(String format) {
    TimeZone timezone = TimeZone.getTimeZone("Asia/Shanghai");

    Date date = new Date(currentTimeMillis());
    SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.getDefault());
    formatter.setTimeZone(timezone);

    GregorianCalendar gregorianCalendar = new GregorianCalendar();
    gregorianCalendar.setTimeZone(timezone);
    String prefix = gregorianCalendar.get(Calendar.AM_PM) == Calendar.AM ? "上午" : "下午";

    return prefix + formatter.format(date);
}
 
開發者ID:GaoGersy,項目名稱:SimpleMutiTypeAdapter,代碼行數:13,代碼來源:TimeUtil.java

示例5: getNameWithDate

public static String getNameWithDate(String name, Date date, Locale locale, String timezone) {
  Calendar cal;
  if (locale != null && timezone != null) {
    cal = GregorianCalendar.getInstance(TimeZone.getTimeZone(timezone), locale);
  } else if (locale != null) {
    cal = GregorianCalendar.getInstance(locale);
  } else if (timezone != null) {
    cal = GregorianCalendar.getInstance(TimeZone.getTimeZone(timezone));
  } else {
    cal = GregorianCalendar.getInstance();
  }
  cal.setTime(date);
  String day = String.valueOf(cal.get(Calendar.DATE));
  if (day.length() == 1) {
    day = "0" + day;
  }
  String month = String.valueOf(cal.get(Calendar.MONTH) + 1);
  if (month.length() == 1) {
    month = "0" + month;
  }
  String hour = String.valueOf(cal.get(Calendar.HOUR));
  if (hour.length() == 1) {
    hour = "0" + hour;
  }
  String minute = String.valueOf(cal.get(Calendar.MINUTE));
  if (minute.length() == 1) {
    minute = "0" + minute;
  }
  return name + "_" + day + "_" + month + "_" + cal.get(Calendar.YEAR) + "_" +
      hour + "_" + minute + "_" + cal.get(Calendar.SECOND) + "_" +
      (cal.get(Calendar.AM_PM) == Calendar.AM ? "AM" : "PM");
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:32,代碼來源:LocalDateUtil.java

示例6: RecentSetting

public RecentSetting (String title, String type) {
    this.title = title;
    this.type = type;
    
    Calendar c = Calendar.getInstance();
    this.date = addZeroOnDateTime(c.get(Calendar.MONTH) + 1) + "/" + 
            addZeroOnDateTime(c.get(Calendar.DATE)) + "/" + 
            c.get(Calendar.YEAR);
    
    this.time = addZeroOnDateTime(c.get(Calendar.HOUR)) + ":" + 
            addZeroOnDateTime(c.get(Calendar.MINUTE)) + ":" + 
            addZeroOnDateTime(c.get(Calendar.SECOND)) + " " + 
            (c.get(Calendar.AM_PM) == Calendar.AM ? "AM" : "PM");
}
 
開發者ID:the-im,項目名稱:enhanced-vnc-thumbnail-viewer,代碼行數:14,代碼來源:RecentSetting.java

示例7: am

boolean am() {
    return get(Calendar.AM_PM) == Calendar.AM;
}
 
開發者ID:jaffa-projects,項目名稱:jaffa-framework,代碼行數:3,代碼來源:DateBase.java


注:本文中的java.util.Calendar.AM屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。