Here you can find the source of createDateFormater(int dataType)
Parameter | Description |
---|---|
dataType | a parameter |
public static DateFormat createDateFormater(int dataType)
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.sql.Types; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Main { /**//from w ww.ja v a2 s. c om * * create DateFormate depend on dataType. * * @param dataType * @return */ public static DateFormat createDateFormater(int dataType) { SimpleDateFormat ret; switch (dataType) { case Types.TIME: ret = new SimpleDateFormat("HH:mm:ss");//$NON-NLS-1$ break; case Types.TIMESTAMP: ret = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//$NON-NLS-1$ break; case Types.DATE: default: ret = new SimpleDateFormat("yyyy-MM-dd");//$NON-NLS-1$ break; } return ret; } }