package Clases;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JOptionPane;

public class Utilidades {
    
    public static boolean isNumeric(String cadena) {
        try {
            Integer.parseInt(cadena);
            return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    }
    public static boolean isDouble(String cadena) {
        try {
                Double.parseDouble(cadena);
                return true;
        } catch (NumberFormatException nfe) {
            return false;
        }
    } //Juanito estubo aqui//
    public static Date stringToDate(String fecha) {
        SimpleDateFormat formatoDelTexto = new SimpleDateFormat("yyyy/MM/dd");
        Date aux = null;
        
        try {
            aux = formatoDelTexto.parse(fecha);
        } catch (Exception e) {
        }
        return aux;
    }
    public static String formatDate(Date hora) {
        
        DateFormat dateTimeFormatter = new SimpleDateFormat("HH:mm:ss");
        return dateTimeFormatter.format(hora);
        
    }
      
 
  
    
    public static String objectToString(Object obj) {
        String str = "";
        if (obj != null) {
            str = obj.toString();
        }
        return str;
    }
    public static int objectToInt(Object obj) {
        int numInt = Integer.parseInt(objectToString(obj));
        return numInt;
    }
    public static double objectToDouble(Object obj) {
        String str = obj.toString();
        double numDouble = Double.valueOf(str).doubleValue();
        return numDouble;
    }

    static String DateFormat(DateFormat HoraReserva) {
        
             DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
 Date date = new Date();
  System.out.println("Hora actual: " + dateFormat.format(date));
     return null;      
    }
 }
