Java Now nowDate(final String formatter)

Here you can find the source of nowDate(final String formatter)

Description

now Date

License

Apache License

Declaration

public static Date nowDate(final String formatter) 

Method Source Code

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

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

import java.util.Date;

public class Main {

    public static Date nowDate(final String formatter) {
        String str = "";
        final SimpleDateFormat sdf = new SimpleDateFormat(formatter);
        Date date = new Date();
        try {//from w w w.j a  v a  2s .  c o m
            str = sdf.format(date);
            date = sdf.parse(str);
        } catch (final ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
}

Related

  1. nowAs14CharString()
  2. nowAsAnsiDate()
  3. nowAsString()
  4. nowAsXSDDateTimeString()
  5. nowDate()
  6. nowDate(String strFormat)
  7. nowDateString()
  8. nowDateString()
  9. nowDateString(String format)