001    package railo.runtime.sql.exp.value;
002    
003    import railo.runtime.exp.PageException;
004    import railo.runtime.op.Caster;
005    import railo.runtime.sql.exp.Literal;
006    import railo.runtime.type.dt.DateTime;
007    
008    
009    public class ValueDate extends ValueSupport implements Literal {
010    
011            private DateTime value;
012    
013            public ValueDate(DateTime value) {
014                    super(value.toString());
015                    this.value=value;
016            }
017            
018            public ValueDate(String strValue) throws PageException {
019                    super(strValue);
020                    this.value=Caster.toDate(strValue,false,null);
021            }
022    
023            @Override
024            public String toString(boolean noAlias) {
025                    if(noAlias || getIndex()==0)return getString();
026                    return getString()+" as "+getAlias();
027            }
028            
029            public Object getValue() {
030                    return value;
031            }
032            
033            public DateTime getValueAsDateTime() {
034                    return value;
035            }
036    }