All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.authorize.util.DateUtil Maven / Gradle / Ivy

Go to download

Authorize.Net SDK includes standard payments, recurring billing, and customer profiles.

There is a newer version: 3.0.0
Show newest version
package net.authorize.util;

import java.util.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class DateUtil{
	public static Date getDateFromFormattedDate(String dateStr,String format){
		try{
			SimpleDateFormat sdf=new SimpleDateFormat(format);
			if(dateStr!=null && !"XXXX".equals(dateStr)){
				Date date=sdf.parse(dateStr);
				return date;
			}
		}
		catch(ParseException pe){
			System.out.println("Exception: " + pe);
		}
		return new Date(0);
	}

	public static String getFormattedDate(Date date, String format){
		try{
			SimpleDateFormat sdf=new SimpleDateFormat(format);
			return sdf.format(date);
		}
		catch(Exception e){
			System.out.println(e);
		}
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy