package net.kagani.utils;

import java.awt.Desktop;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Utils {

	/**
	 * @author: Pax M
	 */

	public static DateFormat dateFormat;
	public static Calendar calender;

	public static void sendOpenURL(String url) {
		Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop()
				: null;
		if ((desktop != null) && (desktop.isSupported(Desktop.Action.BROWSE))) {
			try {
				desktop.browse(new URL(url).toURI());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public static String getTime() {
		try {
			dateFormat = new SimpleDateFormat("HH:mm a");
			calender = Calendar.getInstance();
			return dateFormat.format(calender.getTime());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}