当前位置: 首页>>代码示例>>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;未经允许,请勿转载。