Java Timestamp Create timestamp()

Here you can find the source of timestamp()

Description

timestamp

License

Open Source License

Declaration

public static long timestamp() 

Method Source Code

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

public class Main {
    public static long timestamp(int year, int month, int dayOfMonth) {
        Calendar cal = Calendar.getInstance();
        cal.set(year, month, dayOfMonth, 0, 0);
        cal.set(Calendar.SECOND, 0);
        return cal.getTimeInMillis();
    }/*from  w  ww.  j a v a  2  s .co  m*/

    public static long timestamp() {
        return timestampStartOfDay(System.currentTimeMillis());
    }

    public static long timestampStartOfDay(long time) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(time);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        return cal.getTimeInMillis();
    }
}

Related

  1. getTimestampString(long timeInMillis)
  2. getTimeStampStringFormat(Timestamp ts, String fmt)
  3. getTimestampToOracle()
  4. getTimestampXDaysFromY(long startTimeInMillis, int daysFromStartDate)
  5. getTimeStrByTimestamp(long timestamp, String tz)
  6. timeStamp()
  7. timestamp2string()
  8. timestamp4(int unixTime)
  9. timestampDifference(long ts1, long ts2)