Java Timestamp Format formatString(Timestamp da)

Here you can find the source of formatString(Timestamp da)

Description

format String

License

Apache License

Declaration

public static String formatString(Timestamp da) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

import java.text.SimpleDateFormat;

public class Main {
    public static String formatString(Timestamp da) {
        String datastring = null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        datastring = sdf.format(da);//  w ww.j  a v  a 2 s  . co  m
        return datastring;
    }

    public static String formatString(Timestamp da, String format) {
        String datastring = null;
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        datastring = sdf.format(da);
        return datastring;
    }
}

Related

  1. formatJDBCTimeStamp(final java.util.Date date)
  2. formatJDBCTimeStamp(final java.util.Date date)
  3. formatMillis(long _millis)
  4. formatShortDateTime(Timestamp time)
  5. formatStatement(PreparedStatement statement, List values)
  6. formatStringToTimeStamp(String s)
  7. formattedDateTime(long timestamp)
  8. formatTime(Date aTs_Datetime)
  9. formatTime(Date date)

  10. HOME | Copyright © www.java2s.com 2016