Package railo.runtime.type.dt

Examples of railo.runtime.type.dt.TimeImpl


        return new DateImpl(time);
    }

    @Override
    public Time createTime(long time) {
        return new TimeImpl(time,false);
    }
View Full Code Here


        return new DateImpl(DateTimeUtil.getInstance().toDateTime(null,year,month,day, 0, 0, 0,0));
    }

    @Override
    public Time createTime(int hour, int minute, int second, int millis) {
        return new TimeImpl(
            DateTimeUtil.getInstance().toTime(null,1899,12,30,hour,minute,second,millis,0),false);
    }
View Full Code Here

     * @return Attribute Value
     */
    public Time toTime(Config config, Element el,String attributeName) {
        DateTime dt = toDateTime(config,el,attributeName);
        if(dt==null) return null;
        return new TimeImpl(dt);
    }
View Full Code Here

     * @param attributeName Name of the Attribute to read
     * @param defaultValue if attribute doesn't exist return default value
     * @return Attribute Value
     */
    public Time toTime(Element el,String attributeName, Time defaultValue) {
        return new TimeImpl(toDateTime(el,attributeName,defaultValue));
    }
View Full Code Here

      else if(type==Types.DECIMAL || type==Types.NUMERIC || type==Types.DOUBLE || type==Types.FLOAT) {
        return (Caster.toString(Caster.toDoubleValue(item.getValue())));
      }
    // time types
      else if(type==Types.TIME) {
          return new TimeImpl(DateCaster.toDateAdvanced(item.getValue(),null)).castToString();
      }
    // date types
      else if(type==Types.DATE) {
          return new DateImpl(DateCaster.toDateAdvanced(item.getValue(),null)).castToString();
      }
View Full Code Here

      else if(type==Types.DOUBLE || type==Types.FLOAT || type==Types.NUMERIC || type==Types.DECIMAL ) {
        return Caster.toDouble(item.getValue());
      }
    // time types
      else if(type==Types.TIME) {
          return new TimeImpl(DateCaster.toDateAdvanced(item.getValue(),null)).castToString();
      }
    // date types
      else if(type==Types.DATE) {
          return new DateImpl(DateCaster.toDateAdvanced(item.getValue(),null)).castToString();
      }
View Full Code Here

      else if(type==Types.DOUBLE || type==Types.FLOAT || type==Types.NUMERIC || type==Types.DECIMAL ) {
        return Caster.toDouble(value);
      }
    // time types
      else if(type==Types.TIME) {
          return new TimeImpl(DateCaster.toDateAdvanced(value,null)).castToString();
      }
    // time types
      else if(type==Types.DATE) {
          return new DateImpl(DateCaster.toDateAdvanced(value,null)).castToString();
      }
View Full Code Here

   * @return coverted Date Time Object
   * @throws PageException
   */
  public static Time toTime(TimeZone timeZone,Object o) throws PageException {
      if(o instanceof Time)     return (Time)o;
      else if(o instanceof Date)     return new TimeImpl((Date)o);
    else if(o instanceof Castable)   return new TimeImpl(((Castable)o).castToDateTime());
    else if(o instanceof String)   {
        Time dt=toTime(timeZone,o.toString(),null);
        if(dt==null)
        throw new ExpressionException("can't cast ["+o+"] to time value");
        return dt;
    }
    else if(o instanceof ObjectWrap) return toTime(timeZone,((ObjectWrap)o).getEmbededObject());
    else if(o instanceof Calendar){
      // TODO check timezone offset
      return new TimeImpl(((Calendar)o).getTimeInMillis(),false);
    }
    throw new ExpressionException("can't cast ["+Caster.toClassName(o)+"] to time value");
  }
View Full Code Here

            if(!(ds.fwIfCurrent('\'') && ds.fwIfCurrent('}')))return defaultValue;
           
            if(ds.isAfterLast()){
              long time=util.toTime(timeZone,1899,12,30,hour,minute,second,0,DEFAULT_VALUE);
              if(time==DEFAULT_VALUE)return defaultValue;
              return new TimeImpl(time,false);
            }
            return defaultValue;
       
           
      }
      return defaultValue;
    }
  // Time start with int
    /*else if(ds.isDigit()) {
        char sec=ds.charAt(1);
        char third=ds.charAt(2);
        // 16.10.2004 (02:15)?
      if(sec==':' || third==':') {
        // hour
        int hour=ds.readDigits();
        if(hour==-1) return defaultValue;
       
        if(!ds.fwIfCurrent(':'))return defaultValue;
       
        // minutes
        int minutes=ds.readDigits();
        if(minutes==-1) return defaultValue;
       
        if(ds.isAfterLast()) {
          long time=util.toTime(timeZone,1899,12,30,hour,minutes,0,0,DEFAULT_VALUE);
          if(time==DEFAULT_VALUE) return defaultValue;
         
          return new TimeImpl(time,false);
        }
        //else if(!ds.fwIfCurrent(':'))return null;
        else if(!ds.fwIfCurrent(':')) {
            if(!ds.fwIfCurrent(' '))return defaultValue;
           
            if(ds.fwIfCurrent('a') || ds.fwIfCurrent('A'))  {
                if(ds.fwIfCurrent('m') || ds.fwIfCurrent('M')) {
                    if(ds.isAfterLast()) {
                      long time=util.toTime(timeZone,1899,12,30,hour,minutes,0,0,DEFAULT_VALUE);
                if(time==DEFAULT_VALUE) return defaultValue;
                      return new TimeImpl(time,false);
                    }
                }
                return defaultValue;
            }
            else if(ds.fwIfCurrent('p') || ds.fwIfCurrent('P'))  {
                if(ds.fwIfCurrent('m') || ds.fwIfCurrent('M')) {
                    if(ds.isAfterLast()) {
                      long time=util.toTime(timeZone,1899,12,30,hour<13?hour+12:hour,minutes,0,0,DEFAULT_VALUE);
                if(time==DEFAULT_VALUE) return defaultValue;
                return new TimeImpl(time,false);
                    }
                }
                return defaultValue;
            }
            return defaultValue;
        }
       
       
        // seconds
        int seconds=ds.readDigits();
        if(seconds==-1) return defaultValue;
       
        if(ds.isAfterLast()) {
          long time=util.toTime(timeZone,1899,12,30,hour,minutes,seconds,0,DEFAULT_VALUE);
          if(time==DEFAULT_VALUE) return defaultValue;
          return new TimeImpl(time,false);
        }
               
        }
    }*/
   
    // TODO bessere impl
    ds.reset();
    DateTime rtn = parseTime(timeZone, new int[]{1899,12,30}, ds, defaultValue,-1);
    if(rtn==defaultValue) return defaultValue;
    return new TimeImpl(rtn);
   
   
   
    //return defaultValue;
  }
View Full Code Here

         
         
          if(ds.isAfterLast()){
            long time=util.toTime(timeZone,1899,12,30,hour,minute,second,millis,DEFAULT_VALUE);
            if(time==DEFAULT_VALUE)return defaultValue;
            return new TimeImpl(time,false);
          }
          return defaultValue;
      }
      ds.next();
    // year
View Full Code Here

TOP

Related Classes of railo.runtime.type.dt.TimeImpl

Copyright © 2018 www.massapicom. 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.