/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package web;
import java.util.Calendar;
import java.util.TimeZone;

/**
 *
 * @author Administrator
 */
public class TimeDateUtil {
    public static String  changeFormatDate(String yyyymmdd)
    {
        String year = yyyymmdd.substring(0,4);
        String month = yyyymmdd.substring(4,6);
        String day = yyyymmdd.substring(6,8);

        return "" + (day + "-" + month + "-" + year);
    }

    public static String  changeFormatTime(String hhmm)  
    {
        String hour = hhmm.substring(0,2);
        String minutes = hhmm.substring(2,4);

        return "" + (hour + ":" + minutes);
    }
    public static String  changeFormatDateTimeDelivery(String yyyymmddhhmm)
    {
        String year = yyyymmddhhmm.substring(0,4);
        String month = yyyymmddhhmm.substring(4,6);
        String day = yyyymmddhhmm.substring(6,8);
        String hour = yyyymmddhhmm.substring(8,10);
        String minutes = yyyymmddhhmm.substring(10,12);


        return "" + (day + "-" + month + "-" + year + "/" + hour + ":" + minutes);
    }
    public static String currentTime_HHMM()
    {

        int hour, minutes;
        TimeZone tzSpain = TimeZone.getTimeZone("Spain");
        Calendar calendarSpain = Calendar.getInstance(tzSpain);

        hour = calendarSpain.get(Calendar.HOUR_OF_DAY);
        minutes = calendarSpain.get(Calendar.MINUTE);

        return "" + ((hour<10)? ("0"+hour):(hour)) + ((minutes<10)? ("0"+minutes):(minutes));
    }


}
