List of usage examples for java.util Formatter close
public void close()
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getTimestampString(Calendar val) { if (val == null) { return ("null"); } else {/*from w ww. ja v a 2 s . c om*/ StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", val.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", val.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", val.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", val.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", val.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", val.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getTZDateString(Calendar val) { if (val == null) { return ("null"); } else {//w ww . j ava 2 s .c o m Calendar cal; if (val.getTimeZone().equals(getServerTimeZone())) { cal = val; } else { cal = new GregorianCalendar(getServerTimeZone()); cal.setTimeInMillis(val.getTimeInMillis()); } StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", cal.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", cal.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getTZTimeString(Calendar val) { if (val == null) { return ("null"); } else {/* w ww. j ava2 s . c om*/ Calendar cal; if (val.getTimeZone().equals(getServerTimeZone())) { cal = val; } else { cal = new GregorianCalendar(getServerTimeZone()); cal.setTimeInMillis(val.getTimeInMillis()); } StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", cal.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", cal.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getTZTimestampString(Calendar val) { if (val == null) { return ("null"); } else {//from w w w . j a v a 2 s . c om Calendar cal; if (val.getTimeZone().equals(getServerTimeZone())) { cal = val; } else { cal = new GregorianCalendar(getServerTimeZone()); cal.setTimeInMillis(val.getTimeInMillis()); } StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", cal.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", cal.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java
public static String getTimeString(Calendar val) { if (val == null) { return ("null"); } else {/*from w ww .j a va 2 s.co m*/ StringBuffer buff = new StringBuffer(); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getQuotedTimestampString(Calendar val) { if (val == null) { return ("null"); } else {/*from ww w . j a v a 2 s . c om*/ StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", val.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", val.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", val.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", val.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", val.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", val.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getQuotedTZDateString(Calendar val) { if (val == null) { return ("null"); } else {//w w w .j a va2 s . c o m Calendar cal; if (val.getTimeZone().equals(getServerTimeZone())) { cal = val; } else { cal = new GregorianCalendar(getServerTimeZone()); cal.setTimeInMillis(val.getTimeInMillis()); } StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", cal.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", cal.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getQuotedTZTimeString(Calendar val) { if (val == null) { return ("null"); } else {/*from www .j av a 2s . c o m*/ Calendar cal; if (val.getTimeZone().equals(getServerTimeZone())) { cal = val; } else { cal = new GregorianCalendar(getServerTimeZone()); cal.setTimeInMillis(val.getTimeInMillis()); } StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", cal.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", cal.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseSchema.java
public static String getQuotedTZTimestampString(Calendar val) { if (val == null) { return ("null"); } else {//from ww w. j a va2s . co m Calendar cal; if (val.getTimeZone().equals(getServerTimeZone())) { cal = val; } else { cal = new GregorianCalendar(getServerTimeZone()); cal.setTimeInMillis(val.getTimeInMillis()); } StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); fmt.format("%1$04d", cal.get(Calendar.YEAR)); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.MONTH) + 1); buff.append("-"); fmt.format("%1$02d", cal.get(Calendar.DAY_OF_MONTH)); buff.append("T"); fmt.format("%1$02d", cal.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", cal.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java
public static String getQuotedTimeString(Calendar val) { if (val == null) { return ("null"); } else {/*from w w w . ja v a 2 s . c o m*/ StringBuffer buff = new StringBuffer("'"); Formatter fmt = new Formatter(buff); Calendar db = CFLibDbUtil.getDbServerCalendar(val); fmt.format("%1$02d", db.get(Calendar.HOUR_OF_DAY)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.MINUTE)); buff.append(":"); fmt.format("%1$02d", db.get(Calendar.SECOND)); buff.append("'"); fmt.close(); return (buff.toString()); } }