Java Timestamp Format timeStampFormat(Timestamp t)

Here you can find the source of timeStampFormat(Timestamp t)

Description

time Stamp Format

License

Open Source License

Declaration

public static Date timeStampFormat(Timestamp t) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;
import java.text.DateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Date timeStampFormat(Timestamp t) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        dateFormat.format(t);//from   w w w .  jav a  2  s. co m

        Date d = null;
        try {
            d = dateFormat.parse(dateFormat.format(t));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return d;
    }
}

Related

  1. Timestamp2UTC(Timestamp mytime)
  2. timestampConvertToString(int timeStamp, String format)
  3. timeStampForFileName(final String simpleDateFormat)
  4. timestampFormat(Date date)
  5. timestampFormat(final Date date)
  6. timestampToFormattedDate(Long timestamp)
  7. timestampToString(final Date ts, final String format, final String tzId)
  8. timestampToString(Long timestamp, String formatStr)
  9. timeToString(long timestamp, SimpleDateFormat format)