Java Parse Date parseDateWithTimezone(String dateValue)

Here you can find the source of parseDateWithTimezone(String dateValue)

Description

Parses the date with timezone.

License

Open Source License

Parameter

Parameter Description
dateValue the date value

Exception

Parameter Description
ParseException the parse exception

Return

the date

Declaration

public static Date parseDateWithTimezone(String dateValue) throws ParseException 

Method Source Code


//package com.java2s;
/*/*w ww . j a v a  2s  .  co m*/
 * DateUtil.java
 * Copyright (c) 2014, EcoFactor, All Rights Reserved.
 *
 * This software is the confidential and proprietary information of EcoFactor
 * ("Confidential Information"). You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you entered into with
 * EcoFactor.
 */

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

import java.util.Date;

import java.util.Locale;

public class Main {
    public static final String DATE_MONTH_YEAR_FMT = "d MMMM yyyy";

    /**
     * Parses the date with timezone.
     * @param dateValue the date value
     * @return the date
     * @throws ParseException the parse exception
     */
    public static Date parseDateWithTimezone(String dateValue) throws ParseException {

        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_MONTH_YEAR_FMT, Locale.ENGLISH);
        date = sdf.parse(dateValue);
        return date;
    }
}

Related

  1. parseDateWithFormat(String date, SimpleDateFormat dateFormat, Date defaultDate)
  2. parseDateWithLeniency(final String str, final Locale locale, final String[] parsePatterns, final boolean lenient)
  3. parseDateWithoutTime(final String date)
  4. parseDateWithPattern(Date value, String pattern)
  5. parseDateWithPattern(String dateValue, String pattern)