| 7474 |
vikram.rag |
1 |
package com.amazonservices.mws.products.samples;
|
|
|
2 |
|
|
|
3 |
import java.util.Calendar;
|
|
|
4 |
import java.util.GregorianCalendar;
|
|
|
5 |
|
|
|
6 |
import javax.xml.datatype.DatatypeConfigurationException;
|
|
|
7 |
import javax.xml.datatype.DatatypeFactory;
|
|
|
8 |
import javax.xml.datatype.XMLGregorianCalendar;
|
|
|
9 |
|
|
|
10 |
public class Test {
|
|
|
11 |
public static void main(String[] args){
|
|
|
12 |
XMLGregorianCalendar today = null;
|
|
|
13 |
Calendar localCalendar = Calendar.getInstance();
|
|
|
14 |
|
|
|
15 |
int currentMonth = localCalendar.get(Calendar.MONTH);
|
|
|
16 |
int currentYear = localCalendar.get(Calendar.YEAR);
|
|
|
17 |
int currentDayOfMonth = localCalendar.get(Calendar.DAY_OF_MONTH);
|
|
|
18 |
|
|
|
19 |
try {
|
|
|
20 |
today = DatatypeFactory.newInstance()
|
|
|
21 |
.newXMLGregorianCalendar(
|
|
|
22 |
new GregorianCalendar(currentYear,currentMonth,currentDayOfMonth));
|
|
|
23 |
} catch (DatatypeConfigurationException e) {
|
|
|
24 |
// TODO Auto-generated catch block
|
|
|
25 |
e.printStackTrace();
|
|
|
26 |
}
|
|
|
27 |
finally {
|
|
|
28 |
System.out.println("Today is "+ today);
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
}
|