Package railo.runtime.type.dt

Examples of railo.runtime.type.dt.DateTime


  public static final int LABEL_FORMAT_CURRENCY = 1;
  public static final int LABEL_FORMAT_PERCENT = 2;
  public static final int LABEL_FORMAT_DATE = 3;

  public static String formatDate(PageContext pc,double value) {
    DateTime d = Caster.toDate(Caster.toDouble(value),true,null,null);
   
    try {
      return LSDateFormat.call(pc, d);
    } catch (PageException e) {
    }
View Full Code Here


   * @return difference as int
   * @throws PageException
   */
  public static int compare(Date left, String right) throws PageException {
    if(Decision.isNumeric(right)) return compare(left.getTime()/1000,Caster.toDoubleValue(right));
    DateTime dt=DateCaster.toDateAdvanced(right,true,null,null);
    if(dt!=null) {
      return compare(left.getTime()/1000,dt.getTime()/1000);   
    }
    return Caster.toString(left).compareToIgnoreCase(right);
  }
View Full Code Here

        if(eCount>0)for(int i=0;i<eCount;i++)rtn_*=10;
        return rtn_;
    }
   
    private static double toDoubleValueViaDate(String str) throws CasterException {
    DateTime date = DateCaster.toDateSimple(str, false,false, null, null);// not advanced here, neo also only support simple
    if(date==null)throw new CasterException("can't cast ["+str+"] string to a number value");
      return date.castToDoubleValue(0);
  }
View Full Code Here

    if(date==null)throw new CasterException("can't cast ["+str+"] string to a number value");
      return date.castToDoubleValue(0);
  }
   
    private static double toDoubleValueViaDate(String str,double defaultValue) {
      DateTime date = DateCaster.toDateSimple(str, false,false, null, null);// not advanced here, neo also only support simple
    if(date==null)return defaultValue;
      return date.castToDoubleValue(0);
  }
View Full Code Here

     */
    private final void readCollection(Config config, Element el) throws SearchException {
        SearchCollectionPlus sc;
        //try {
            // Collection
            DateTime last = DateCaster.toDateAdvanced(el.getAttribute("lastUpdate"),ThreadLocalPageContext.getTimeZone(config),null);
            if(last==null)last=new DateTimeImpl();
            DateTime cre = DateCaster.toDateAdvanced(el.getAttribute("created"),ThreadLocalPageContext.getTimeZone(config),null);
            if(cre==null)cre=new DateTimeImpl();
            ResourceProvider frp = ResourcesImpl.getFileResourceProvider();
            sc =(SearchCollectionPlus) _readCollection(
                    el.getAttribute("name"),
                    frp.getResource(el.getAttribute("path")),
View Full Code Here

    return _call(pc,object,mask, strTimezone==null?ThreadLocalPageContext.getTimeZone(pc):TimeZoneUtil.toTimeZone(strTimezone));
  }
 
  private static String _call(PageContext pc , Object object, String mask,TimeZone tz) throws ExpressionException {
    Locale locale=Locale.US;//:pc.getConfig().getLocale();
    DateTime datetime = Caster.toDate(object,true,tz,null);
    if(datetime==null) {
        if(object.toString().trim().length()==0) return "";
        throw new ExpressionException("can't convert value "+object+" to a datetime value");
    }
   
View Full Code Here

    return _call(pc,object,mask, strTimezone==null?ThreadLocalPageContext.getTimeZone(pc):TimeZoneUtil.toTimeZone(strTimezone));
  }
 
  private static String _call(PageContext pc , Object object, String mask,TimeZone tz) throws ExpressionException {
    Locale locale=Locale.US;//:pc.getConfig().getLocale();
    DateTime datetime = Caster.toDate(object,true,tz,null);
    if(datetime==null) {
        if(StringUtil.isEmpty(object,true)) return "";
        throw new ExpressionException("can't convert value "+object+" to a datetime value");
    }
   
View Full Code Here

    return _call(pc, object, mask, strTimezone==null?ThreadLocalPageContext.getTimeZone(pc):TimeZoneUtil.toTimeZone(strTimezone));
  }
  private static String _call(PageContext pc , Object object, String mask,TimeZone tz) throws PageException {
      Locale locale=Locale.US;
     
    DateTime datetime = DateCaster.toDateAdvanced(object,tz,null);
      //Caster.toDate(object,true,tz,null);
    if(datetime==null) {
      if(StringUtil.isEmpty(object,true)) return "";
        throw new CasterException(object,"datetime");
        //if(!Decision.isSimpleValue(object))
View Full Code Here

    return invoke(pc,object,mask, Locale.US,strTimezone==null?ThreadLocalPageContext.getTimeZone(pc):TimeZoneUtil.toTimeZone(strTimezone));
  }
 
  public static String invoke(PageContext pc , Object object, String mask,Locale locale,TimeZone tz) throws ExpressionException {
    if(locale==null) locale=Locale.US;
    DateTime datetime = Caster.toDate(object,true,tz,null);
    if(datetime==null) {
        if(object.toString().trim().length()==0) return "";
        throw new ExpressionException("can't convert value "+object+" to a datetime value");
    }
    java.text.DateFormat format=null;
View Full Code Here

  }

  private static DateTime toDateLS(PageContext pc ,Locale locale, TimeZone timeZone, Object object) throws PageException {
    if(object instanceof DateTime) return (DateTime) object;
    else if(object instanceof CharSequence) {
      DateTime res = DateCaster.toDateTime(locale,Caster.toString(object),timeZone,null,locale.equals(Locale.US));
      if(res!=null)return res;
    }
    return DateCaster.toDateAdvanced(object,timeZone);
  }
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.