Java Timestamp Create createTimestamp(int month, int day)

Here you can find the source of createTimestamp(int month, int day)

Description

create Timestamp

License

Open Source License

Declaration

public static Timestamp createTimestamp(int month, int day) 

Method Source Code


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

import java.sql.Timestamp;
import java.util.Calendar;

public class Main {
    public static Timestamp createTimestamp(int year, int month, int day, int hour, int minute, int second) {
        Calendar c = Calendar.getInstance();
        c.set(year, month - 1, day, hour, minute, second);
        c.set(Calendar.MILLISECOND, 0);
        return new Timestamp(c.getTimeInMillis());
    }//from  w  w  w. j  a v a 2s .co m

    public static Timestamp createTimestamp(int year, int month, int day, int hour, int minute) {
        Calendar c = Calendar.getInstance();
        c.set(year, month - 1, day, hour, minute, 0);
        c.set(Calendar.MILLISECOND, 0);
        return new Timestamp(c.getTimeInMillis());
    }

    public static Timestamp createTimestamp(int year, int month, int day) {
        Calendar c = Calendar.getInstance();
        c.set(year, month - 1, day, 0, 0, 0);
        c.set(Calendar.MILLISECOND, 0);
        return new Timestamp(c.getTimeInMillis());
    }

    public static Timestamp createTimestamp(int month, int day) {
        Calendar c = Calendar.getInstance();
        c.set(c.get(Calendar.YEAR), month - 1, day, 0, 0, 0);
        c.set(Calendar.MILLISECOND, 0);
        return new Timestamp(c.getTimeInMillis());
    }
}

Related

  1. createTimestamp()
  2. createTimeStamp()
  3. createTimeStamp()
  4. createTimestamp(final int aYear, final int aMonth, final int aDate, final int aHour, final int aMinute, final int aSecond)
  5. createTimestamp(final int year, final int month, final int day, final int hour, final int minute, final int second)
  6. createTimestampedZipFilename(String prefix)
  7. createTimestampFormat()
  8. createTimeStamps()
  9. getTimestamp()