Java Time Format getFormattedDateTime(String date, String dateFormat)

Here you can find the source of getFormattedDateTime(String date, String dateFormat)

Description

get Formatted Date Time

License

Apache License

Declaration

public static String getFormattedDateTime(String date, String dateFormat) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static String getFormattedDateTime(String date, String dateFormat) {
        try {/*from  w  ww  .  jav a  2  s . c  o m*/
            return new SimpleDateFormat(dateFormat)
                    .format(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(date));
        } catch (ParseException e) {
            return "";
        }
    }
}

Related

  1. getFormatDateTime(java.util.Date date)
  2. getFormattedCurrentDateAndTime()
  3. getFormattedCurrentDateTime(String pattern)
  4. getFormattedDateAndTime(final Date date)
  5. getFormattedDateTime(Date date, String pattern)
  6. getFormattedDuration(long fromTime)
  7. getFormattedFileTime(File f, String format)
  8. getFormattedTime()
  9. getFormattedTime(Date date)