+ 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());
/** * 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; }
@Override public String toString() { return wrapped.toString(); } }
/** * Returns a string representation of this timing specifier. */ public String toString() { return "wallclock(" + time.toString() + ")"; }
/** * 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(); }
/** * Returns a string representation of this timing specifier. */ public String toString() { return "wallclock(" + time.toString() + ")"; }
/** * Returns a string representation of this timing specifier. */ public String toString() { return "wallclock(" + time.toString() + ")"; }
//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());
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()); } }
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));
public static ZonalTimestampTypeDescriptor getInstance(TimeZone zone) { if (instance != null) { final String calendar = zonalCalendar.toString(); throw new IllegalStateException("Configured already: '" + calendar + "'"); } return new ZonalTimestampTypeDescriptor(zone); }
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()); }
public RTObject toStringCall() { final String string = theDate_.toString(); return new RTStringObject(string); } public void setYear(final RTObject year) {
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); } }
@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(); }
@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(); }
@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(); }