Package java.util

Examples of java.util.GregorianCalendar.clear()


            // set it into a calendar
            GregorianCalendar cal;
            if (year < 1800) {
                cal = new GregorianCalendar();
                cal.setGregorianChange(BEGINNING_OF_TIME);
                cal.clear();
                cal.set(year, month, day+1);
            } else {
                cal = new GregorianCalendar(year, month, day+1);
            }
            return new java.sql.Date(cal.getTime().getTime());
View Full Code Here


     */
    private DateTime getDateTime(int year, int month, int day, int hour,
                                 int min, int sec) throws Exception {
        GregorianCalendar convertCal =
            new GregorianCalendar(DateUtil.TIMEZONE_GMT);
        convertCal.clear();
        convertCal.set(Calendar.YEAR, year);
        //The MONTH is 0 based. The incoming month is 1 based
        convertCal.set(Calendar.MONTH, month - 1);
        convertCal.set(Calendar.DAY_OF_MONTH, day);
        convertCal.set(Calendar.HOUR_OF_DAY, hour);
View Full Code Here

    int doy = ds.readAttributeInteger(null, "DAY", -1);
    double time = ds.readAttributeDouble(null, "TIME", Double.NaN);

    if ((year >0) && (doy > 0) && !Double.isNaN(time)) {
      Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
      cal.clear();
      cal.set(Calendar.YEAR, year);
      cal.set(Calendar.DAY_OF_YEAR, doy);

      int hour = (int) time;
      cal.set(Calendar.HOUR_OF_DAY, hour);
View Full Code Here

            int minute = raf.read();
            int second = raf.read();
            //System.out.println( "PDS date:" + year +":" + month +
            //":" + day + ":" + hour +":" + minute +":" + second );
            GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
            c.clear();
            c.set(year, month, day, hour, minute, second);
            endTI = c.getTime();
            // 42
            timeRanges = raf.read();
            //System.out.println( "PDS timeRanges=" + timeRanges ) ;
View Full Code Here

            // 54
            int second = raf.read();
            //System.out.println( "PDS date:" + year +":" + month +
            //":" + day + ":" + hour +":" + minute +":" + second );
            GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
            c.clear();
            c.set(year, month, day, hour, minute, second);
            endTI = c.getTime();
            // 55
            timeRanges = raf.read();
            //System.out.println( "PDS timeRanges=" + timeRanges ) ;
View Full Code Here

   if (index > 0)
      isodate = isodate.substring(0, index) + "T" + isodate.substring(index+1);
   StringTokenizer st = new StringTokenizer(isodate, "-T:.+Z", true);

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

   */
  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

            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

            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.