Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.amazonservices.mws.products.samples;

import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

public class Test {
        public static void main(String[] args){
                                        XMLGregorianCalendar today = null;
                                        Calendar localCalendar = Calendar.getInstance();
                                    
                                    int currentMonth = localCalendar.get(Calendar.MONTH);
                                    int currentYear = localCalendar.get(Calendar.YEAR);
                                    int currentDayOfMonth = localCalendar.get(Calendar.DAY_OF_MONTH);

        try {
                  today = DatatypeFactory.newInstance()
                    .newXMLGregorianCalendar(
                                new GregorianCalendar(currentYear,currentMonth,currentDayOfMonth));
                } catch (DatatypeConfigurationException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
                finally {
                        System.out.println("Today is "+ today);
                }
        }
}