001 package railo.runtime.query.caster; 002 003 import java.io.IOException; 004 import java.sql.ResultSet; 005 import java.sql.SQLException; 006 import java.sql.Timestamp; 007 import java.util.Calendar; 008 import java.util.TimeZone; 009 010 import railo.commons.date.TimeZoneUtil; 011 import railo.runtime.engine.ThreadLocalPageContext; 012 import railo.runtime.type.dt.DateTimeImpl; 013 014 public class TimestampCast implements Cast{ 015 016 @Override 017 public Object toCFType(TimeZone tz,int type, ResultSet rst, int columnIndex) throws SQLException, IOException { 018 Calendar c=TimeZoneUtil.getCalendar(ThreadLocalPageContext.getTimeZone(tz)); 019 Timestamp ts = rst.getTimestamp(columnIndex,c); 020 if(ts==null) return null; 021 return new DateTimeImpl(ts.getTime(),false); 022 } 023 }