Package test.dwr

Source Code of test.dwr.DayFromDate

package test.dwr;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class DayFromDate
{
    private Log log = LogFactory.getLog(DayFromDate.class);
   
    public Map<String, Integer> getDay(String aDate) throws Exception
    {
        Calendar calendar = new GregorianCalendar(Locale.ENGLISH);
        Map<String, Integer> aMap = new HashMap<String, Integer>();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        formatter.setCalendar(calendar);
        calendar.setTime(formatter.parse(aDate));
        log.info("Date processed is: " + calendar.getTime());
        aMap.put(aDate, calendar.get(Calendar.DAY_OF_WEEK));
        return aMap;
    }
}
TOP

Related Classes of test.dwr.DayFromDate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.