Package railo.runtime.type.dt

Examples of railo.runtime.type.dt.DateTime


      if(o instanceof DateTime) return (DateTime)o;
      return new DateTimeImpl((Date)o);
    }
    else if(o instanceof Castable)   return ((Castable)o).castToDateTime();
    else if(o instanceof String)   {
        DateTime dt=toDateAdvanced((String)o,timezone,null);
        if(dt==null)
        throw new ExpressionException("can't cast ["+o+"] to date value");
        return dt;
    }
    else if(o instanceof Number)     return util.toDateTime(((Number)o).doubleValue());
View Full Code Here


   * @param timezone
   * @return Date Time Object
   * @throws PageException
   */
  public static DateTime toDateAdvanced(String str,TimeZone timezone) throws PageException {
    DateTime dt=toDateAdvanced(str,timezone,null);
      if(dt==null)
      throw new ExpressionException("can't cast ["+str+"] to date value");
      return dt;
  }
View Full Code Here

   */
  public static DateTime toDateAdvanced(String str,boolean alsoNumbers,TimeZone timeZone, DateTime defaultValue) {
    str=str.trim();
    if(StringUtil.isEmpty(str)) return defaultValue;
    timeZone=ThreadLocalPageContext.getTimeZone(timeZone);
    DateTime dt=toDateSimple(str,alsoNumbers,true,timeZone,defaultValue);
    if(dt==null) { 
        DateFormat[] formats = FormatUtil.getCFMLFormats(timeZone, true);
        synchronized(formats){
          Date d;
          ParsePosition pp=new ParsePosition(0);
View Full Code Here

     * @return DateTime Object
     * @throws PageException
     */
    public static DateTime toDateTime(Locale locale,String str, TimeZone tz,boolean useCommomDateParserAsWell) throws PageException {
       
      DateTime dt=toDateTime(locale, str, tz,null,useCommomDateParserAsWell);
        if(dt==null){
          /* FUTURE 4.1
          String prefix=locale.getLanguage()+"-"+locale.getCountry()+"-";
          throw new ExpressionException("can't cast ["+str+"] to date value",
              "to add custom formats for "+LocaleFactory.toString(locale)+
View Full Code Here

   * @param timeZone
   * @return coverted Date Time Object
   * @throws PageException
   */
  public static DateTime toDateSimple(String str, TimeZone timeZone) throws PageException {
     DateTime dt=toDateSimple(str,true,true, timeZone,null);
     if(dt==null)
       throw new ExpressionException("can't cast ["+str+"] to date value");
     return dt;
  }
View Full Code Here

     * @param timeZone
     * @return coverted Date Time Object
     * @throws PageException 
     */
    public static DateTime toDateSimple(String str,boolean alsoNumbers,boolean alsoMonthString, TimeZone timeZone) throws PageException {
        DateTime dt = toDateSimple(str,alsoNumbers,alsoMonthString,timeZone,null);
        if(dt==null) throw new ExpressionException("can't cast value to a Date Object");
        return dt;
    }
View Full Code Here

        if(dt==null) throw new ExpressionException("can't cast value to a Date Object");
        return dt;
    }
   
    public static DateTime toDateAdvanced(Object o,boolean alsoNumbers, TimeZone timeZone) throws PageException {
        DateTime dt = toDateAdvanced(o,alsoNumbers,timeZone,null);
        if(dt==null) throw new ExpressionException("can't cast value to a Date Object");
        return dt;
    }
View Full Code Here

        }
    }*/
   
    // 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);
   
   
   
View Full Code Here

  private static DateTime parseOffset(DateString ds, TimeZone timeZone, int[] date,int hours, int minutes, int seconds, int msSeconds,DateTime defaultValue) {
    if(ds.isLast() && (ds.fwIfCurrent('Z') ||  ds.fwIfCurrent('z'))) {
      return util.toDateTime(TimeZoneConstants.UTC, date[0], date[1], date[2], hours, minutes, seconds, msSeconds,defaultValue);
    }
    else if(ds.fwIfCurrent('+')){
        DateTime rtn = util.toDateTime(timeZone, date[0], date[1], date[2], hours, minutes, seconds, msSeconds,defaultValue);
        if(rtn==defaultValue) return rtn;
            return readOffset(true,timeZone,rtn,date[0], date[1], date[2], hours, minutes, seconds, msSeconds,ds,defaultValue);
      }
      else if(ds.fwIfCurrent('-')){
        DateTime rtn = util.toDateTime(timeZone, date[0], date[1], date[2], hours, minutes, seconds, msSeconds, defaultValue);
        if(rtn==defaultValue) return rtn;
           return readOffset(false,timeZone,rtn,date[0], date[1], date[2], hours, minutes, seconds, msSeconds,ds,defaultValue);
      }
    return defaultValue;
  }
View Full Code Here

   
  // Timestamp
    if(ds.isCurrent('{') && ds.isLast('}')) {
      return _toDateSimpleTS(ds,timeZone,defaultValue);
    }
    DateTime res = parseDateTime(str,ds,alsoNumbers,alsoMonthString,timeZone,defaultValue);
    if(alsoNumbers && res==defaultValue && Decision.isNumeric(str)) {
          double dbl = Caster.toDoubleValue(str,Double.NaN);
          if(Decision.isValid(dbl))return util.toDateTime(dbl);
      }
    return res;
View Full Code Here

TOP

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

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.