java.util.Calendar.toString()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(198)

本文整理了Java中java.util.Calendar.toString()方法的一些代码示例,展示了Calendar.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.toString()方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:toString

Calendar.toString介绍

[英]Returns a string representation of this Calendar, showing which fields are set.
[中]返回此日历的字符串表示形式,显示设置了哪些字段。

代码示例

代码示例来源:origin: stackoverflow.com

+ dfLondonWithTZ.format(londonCalendar.getTime()));
System.out.println("  time (default format)    = "
    + londonCalendar.getTime() + " / " + londonCalendar.toString());
    + dfNewYorkWithTZ.format(newYorkCalendar.getTime()));
System.out.println("  time (default format)    = "
    + newYorkCalendar.getTime() + " / " + newYorkCalendar.toString());
    + dfSydneyWithTZ.format(sydneyCalendar.getTime()));
System.out.println("  time (default format)    = "
    + sydneyCalendar.getTime() + " / " + sydneyCalendar.toString());

代码示例来源:origin: org.apache.poi/poi-ooxml

val = property.getLpstr();
} else if (property.isSetDate()) {
  val = property.getDate().toString();
} else if (property.isSetFiletime()) {
  val = property.getFiletime().toString();
} else if (property.isSetBool()) {
  val = Boolean.toString(property.getBool());

代码示例来源:origin: pentaho/mondrian

/**
 * Creates a calendar in UTC, and initializes it to a given year, month,
 * day, hour, minute, second. <b>NOTE: month is 1-based</b>
 */
public static Calendar createCalendar(
  int year,
  int month,
  int day,
  int hour,
  int minute,
  int second)
{
  Calendar calendar = Calendar.getInstance();
  calendar.setTimeZone(Schedule.utcTimeZone);
  calendar.toString(); // calls complete()
  calendar.set(Calendar.YEAR, year);
  calendar.set(Calendar.MONTH, month - 1); // CONVERT TO 0-BASED!!
  calendar.set(Calendar.DAY_OF_MONTH, day);
  calendar.set(Calendar.HOUR_OF_DAY, hour);
  calendar.set(Calendar.MINUTE, minute);
  calendar.set(Calendar.SECOND, second);
  calendar.set(Calendar.MILLISECOND, 0);
  return calendar;
}

代码示例来源:origin: com.aoindustries/ao-lang

@Override
  public String toString() {
    return wrapped.toString();
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Returns a string representation of this timing specifier.
 */
public String toString() {
  return "wallclock(" + time.toString() + ")";
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base

/**
 * Returns a string representation of this calendar. This method
 * is intended to be used only for debugging purposes, and the
 * format of the returned string may vary between implementations.
 * The returned string may be empty but may not be <code>null</code>.
 *
 * @return  a string representation of this calendar.
 * @stable ICU 2.0
 */
public String toString() {
  return calendar.toString();
}

代码示例来源:origin: apache/batik

/**
 * Returns a string representation of this timing specifier.
 */
public String toString() {
  return "wallclock(" + time.toString() + ")";
}

代码示例来源:origin: org.apache.xmlgraphics/batik-anim

/**
 * Returns a string representation of this timing specifier.
 */
public String toString() {
  return "wallclock(" + time.toString() + ")";
}

代码示例来源:origin: stackoverflow.com

//Create an Calendar object set to todays date & time
Calendar calendar = Calendar.getInstance();
Log.d(Tag, "Now : "+ calendar.toString());

//Set the Calendar to the first day of Month
calendar.set(Calendar.DAY_OF_MONTH,1);
//UPDATE BY CALLING getTimeInMillis() or any of the previously mentioned functions
calendar.getTimeInMillis();
Log.d(Tag, "Calendar.DAY_OF_MONTH,1: "+ calendar.toString());

代码示例来源:origin: stackoverflow.com

Calendar cal = new GregorianCalendar();
int day = cal.get(Calendar.DAY_OF_WEEK);
cal.add(Calendar.DAY_OF_MONTH, -day);
System.out.println(cal.toString());
cal.add(Calendar.DAY_OF_MONTH, 6);
System.out.println(cal.toString();

代码示例来源:origin: stackoverflow.com

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;

 class Xxx {
   public static void main(String[] args) {
    Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("Asia/Tokyo"));
    calendar.setTimeInMillis(1457298145 * 1000L);
    System.out.println(calendar.toString());
  }
}

代码示例来源:origin: stackoverflow.com

GregorianCalendar g=new GregorianCalendar(1975, 5, 7);
 Date d=g.getTime();
 System.out.println(g.toString());
 SimpleDateFormat formatter=new SimpleDateFormat("yyyy MM dd"); 
 System.out.println(formatter.format(d));

代码示例来源:origin: org.n52.series-api.db/dao

public static ZonalTimestampTypeDescriptor getInstance(TimeZone zone) {
  if (instance != null) {
    final String calendar = zonalCalendar.toString();
    throw new IllegalStateException("Configured already: '" + calendar + "'");
  }
  return new ZonalTimestampTypeDescriptor(zone);
}

代码示例来源:origin: SecUSo/privacy-friendly-pedometer

public static void startHardwareStepCounter(Context context){
  Intent hardwareStepCounterServiceIntent = new Intent(context, HardwareStepCountReceiver.class);
  PendingIntent sender = PendingIntent.getBroadcast(context, 2, hardwareStepCounterServiceIntent, 0);
  AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
  Calendar calendar = Calendar.getInstance();
  calendar.setTime(new Date());
  calendar.add(Calendar.MINUTE, 5);
  // Set inexact repeating alarm
  am.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTime().getTime(), AlarmManager.INTERVAL_HOUR, sender);
  Log.i(LOG_CLASS, "Scheduled hardware step counter alert at start time " + calendar.toString());
}

代码示例来源:origin: jcoplien/trygve

public RTObject toStringCall() {
  final String string = theDate_.toString();
  return new RTStringObject(string);
}
public void setYear(final RTObject year) {

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

sb.append((dtStart != null) ? dtStart.toString() : "null");
sb.append(",duration=");
sb.append((duration != null) ? duration.toString() : "null");
sb.append(interval);
sb.append(",until=");
sb.append((until != null) ? until.toString() : "null");
sb.append(",byDay=");

代码示例来源:origin: org.onehippo.cms7/hippo-repository-api

public static String createXPathConstraint(final Session session,
                      final Calendar calendar) {
  try {
    return "xs:dateTime('"+session.getValueFactory().createValue(calendar).getString()+ "')";
  } catch (RepositoryException e) {
    throw new IllegalArgumentException("RepositoryException while creating a calendar jcr Value " +
        "for '"+calendar.toString()+"'", e);
  }
}

代码示例来源:origin: stackoverflow.com

@GET
@Path("calendar")
@Produces("text/calendar")
public Response generateCalendar() {
 Calendar calendar = new Calendar();
 // Generate your calendar here
 ResponseBuilder builder = Response.ok();
 builder.header("content-disposition", "attachment;filename=calendar.ics");
 builder.entity(calendar.toString());
 return builder.build();
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-imaging-api

@Override
public String getHash() {
  Blob blob = getBlob();
  if (blob != null) {
    String h = blob.getDigest();
    if (h != null) {
      return h;
    }
  }
  return doc.getId() + xPath + getModificationDate().toString();
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-imaging-api

@Override
public String getHash() {
  Blob blob = getBlob();
  if (blob != null) {
    String h = blob.getDigest();
    if (h != null) {
      return h;
    }
  }
  return doc.getId() + xPath + getModificationDate().toString();
}

相关文章