Java Day dayToMilliSeconds(String day, String timeZone)

Here you can find the source of dayToMilliSeconds(String day, String timeZone)

Description

Convert String of day to epoch time for targeted time zone.

License

Open Source License

Parameter

Parameter Description
day a parameter
timeZone a parameter

Exception

Parameter Description
ParseException an exception

Declaration

public static long dayToMilliSeconds(String day, String timeZone) throws ParseException 

Method Source Code


//package com.java2s;

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

import java.util.TimeZone;

public class Main {
    /**//from ww  w  . j  a  va2 s  . c o  m
     * Convert String of day to epoch time for targeted time zone.
     * @param day
     * @param timeZone
     * @return
     * @throws ParseException
     */
    public static long dayToMilliSeconds(String day, String timeZone) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
        return simpleDateFormat.parse(day).getTime();
    }
}

Related

  1. dayOfWeekAbr(Date date)
  2. daysFrom(Date date, int amount, String format)
  3. daysOfnumbe(Date sDate, int number)
  4. daySub(Date fDate, Date oDate)
  5. daysWeekName(boolean shortName, Locale locale)
  6. dayToUTCSeconds(String day)
  7. getDateYYMMDD()
  8. getDateYYMMDD(java.util.Date date)
  9. getDay(Date date)