Example usage for java.util Formatter Formatter

List of usage examples for java.util Formatter Formatter

Introduction

In this page you can find the example usage for java.util Formatter Formatter.

Prototype

public Formatter(OutputStream os) 

Source Link

Document

Constructs a new formatter with the specified output stream.

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getQuotedTZTimeString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {/*  w  w w  .j av  a2s  .  com*/
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer("'");
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append(" ");
        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());
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public static String getTZTimeString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {//from   w  w w .  j  a v  a  2 s  .  c o  m
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append("-");
        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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getQuotedTZTimestampString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {//w w  w. j  ava 2 s . com
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer("'");
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append(" ");
        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());
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public static String getTZTimestampString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {//from  w w  w . j  a  va2 s  . c om
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append("-");
        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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getDateString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {//w w  w  . j a  v a2s. c om
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        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 w  w  . j a v a 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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getTimestampString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {//from w  ww.j av a 2 s. c om
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append(" ");
        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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getTZDateString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {/*from   ww w.  j  a v  a 2 s .c  o m*/
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append(" ");
        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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getTZTimeString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {/*from  w w w  .  j  a va 2  s  .  c  o  m*/
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append(" ");
        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.cfacc.v2_0.CFAccMSSql.CFAccMSSqlSchema.java

public static String getTZTimestampString(Calendar val) {
    if (val == null) {
        return ("null");
    } else {//from w  w  w . ja v a 2s . com
        Calendar db = CFLibDbUtil.getDbServerCalendar(val);
        StringBuffer buff = new StringBuffer();
        Formatter fmt = new Formatter(buff);
        fmt.format("%1$04d", db.get(Calendar.YEAR));
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.MONTH) + 1);
        buff.append("-");
        fmt.format("%1$02d", db.get(Calendar.DAY_OF_MONTH));
        buff.append(" ");
        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());
    }
}