Package java.util

Examples of java.util.Calendar.clear()


   */
  private static TimeId3Frame createTimeField(TextId3Frame tdat,
      TextId3Frame time, TextId3Frame tyer) {
    TimeId3Frame result = null;
    Calendar calendar = new GregorianCalendar();
    calendar.clear();
    try {
      if (tdat != null) {
        if (tdat.getContent().length() == 4) {
          calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(tdat
              .getContent().substring(0, 2)));
View Full Code Here


      result = new TimeId3Frame(RECORD_DAT, calendar);
    } catch (NumberFormatException e) {
      System.err.println("Numberformatexception occured "
          + "in timestamp interpretation, date is set to zero.");
      e.printStackTrace();
      calendar.clear();
    }
    return result;
  }

}
View Full Code Here

        assertNotSame(adjustedMonday, newSunday());
    }

    private Date newMonday() {
        Calendar c = (Calendar) Calendar.getInstance().clone();
        c.clear();
        c.set(Calendar.YEAR, 2004);
        c.set(Calendar.MONTH, Calendar.NOVEMBER);
        c.set(Calendar.DAY_OF_MONTH, 8);
        return c.getTime();
    }
View Full Code Here

        return c.getTime();
    }

    private Date newSunday() {
        Calendar c = (Calendar) Calendar.getInstance().clone();
        c.clear();
        c.set(Calendar.YEAR, 2004);
        c.set(Calendar.MONTH, Calendar.NOVEMBER);
        c.set(Calendar.DAY_OF_MONTH, 14);
        return c.getTime();
View Full Code Here

     * @param timeStamp the time to convert
     * @return the <code>java.util.Date</code> representing the long
     */
    public static Date adTimeToJavaDate(long timeStamp) {
        Calendar calendar = Calendar.getInstance();
        calendar.clear();
        calendar.set(1601, 0, 1, 0, 0);
        timeStamp = timeStamp / 10000 + calendar.getTime().getTime();
        return new Date(timeStamp);
    }

View Full Code Here

        GanttLanguage.getInstance().setLocale(null);
        Calendar c = (Calendar) GanttLanguage.getInstance().newCalendar();
        Date now = GregorianCalendar.getInstance().getTime();
        c.setTime(now);
        for (int i = Calendar.DAY_OF_MONTH + 1; i <= Calendar.MILLISECOND; i++) {
            c.clear(i);
        }
        Date result = c.getTime();
        System.err.println(result);
    }
}
View Full Code Here

            throws InvalidDateException {
        // YYYY-MM-DDThh:mm:ss.sTZD
        StringTokenizer st = new StringTokenizer(isodate, "-T:.+Z", true);

        Calendar calendar = new GregorianCalendar();
        calendar.clear();
        try {
            // Year
            if (st.hasMoreTokens()) {
                int year = Integer.parseInt(st.nextToken());
                calendar.set(Calendar.YEAR, year);
View Full Code Here

        p = s.indexOf(','); if (p >= 0) s = s.substring(0, p); // a comma may be used to separate two dates from each other; then we take the first
        while (s.length() > 0 && s.endsWith("?")) s = s.substring(0, s.length() - 1); // sometimes used if write is not sure about date
       
        // no go for exact parsing
        final Calendar cal = Calendar.getInstance(TZ_GMT, Locale.US);
        cal.clear();
       
        // split 2007-12-19T10:20:30.789+0500 into its parts
        // correct: yyyy['-'MM['-'dd['T'HH':'MM[':'ss['.'SSS]]('Z'|ZZZZZ)]]]
        final StringTokenizer t = new StringTokenizer(s, "-T:.Z+", true);
        if (s == null || t.countTokens() == 0)
View Full Code Here

        // insert rows:
        db.beginTransaction(SqlJetTransactionMode.WRITE);
        try {
            Calendar calendar = Calendar.getInstance();
            ISqlJetTable table = db.getTable(TABLE_NAME);
            calendar.clear();
            calendar.set(1981, 4, 19);
            table.insert("Prochaskova", "Elena", calendar.getTimeInMillis());
            calendar.set(1967, 5, 19);
            table.insert("Scherbina", "Sergei", calendar.getTimeInMillis());
            calendar.set(1987, 6, 19);
View Full Code Here

            stmt.executeUpdate("create table testA(data timestamp);");

            TimeZone pst = TimeZone.getTimeZone("PST");
            Calendar cal = new GregorianCalendar(pst);

            cal.clear();
            cal.set(2005, 0, 1, 0, 0, 0);


            // yyyy-mm-dd hh:mm:ss.fffffffff
            Timestamp ts = new Timestamp(cal.getTimeInMillis());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.