Java Date to Time getTimeLocalWithoutDst(java.util.Date d)

Here you can find the source of getTimeLocalWithoutDst(java.util.Date d)

Description

Get the number of milliseconds since 1970-01-01 in the local timezone, but without daylight saving time into account.

License

Mozilla Public License

Parameter

Parameter Description
d the date

Return

the milliseconds

Declaration

public static long getTimeLocalWithoutDst(java.util.Date d) 

Method Source Code

//package com.java2s;
/*/*w w w  .java2s .  c om*/
 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
 * and the EPL 1.0 (http://h2database.com/html/license.html).
 * Initial Developer: H2 Group
 * Iso8601:
 * Initial Developer: Robert Rathsack (firstName dot lastName at gmx dot de)
 */

import java.util.Calendar;

public class Main {
    private static final ThreadLocal<Calendar> CACHED_CALENDAR = new ThreadLocal<Calendar>() {
        @Override
        protected Calendar initialValue() {
            return Calendar.getInstance();
        }
    };

    /**
     * Get the number of milliseconds since 1970-01-01 in the local timezone,
     * but without daylight saving time into account.
     *
     * @param d the date
     * @return the milliseconds
     */
    public static long getTimeLocalWithoutDst(java.util.Date d) {
        return d.getTime() + CACHED_CALENDAR.get().get(Calendar.ZONE_OFFSET);
    }
}

Related

  1. getTimeFromDate(final Date date)
  2. getTimeImMillis(Date date)
  3. getTimeInSeconds(Date date)
  4. getTimeInterval(Date fromDate)
  5. getTimeIntervalMins(Date firstDate, Date lastDate)
  6. getTimeLocalWithoutDst(java.util.Date d)
  7. getTimeMargin(String dateTime)
  8. getTimeMax(Date date)
  9. getTimeOfDate(Date date)