Traditional Culture Encyclopedia - The 24 Solar Terms - Java character conversion solar terms
Java character conversion solar terms
Import java.text.simpledateformat;
Import java.util.date;
Import java.util.gregoriancalendar;
Public class DateTest 1 {
public static int trans(String str){
int result = 0;
if ("Dec "。 Equal to (string)) (
Results =11;
}//This place needs 12 months of renovation.
Return the result;
}
Public static void main(String[] args) {
string str = " 20 Dec 2065 438+02 10am 1 1 30 ";
string[]arr = str . split(" ");
int year = integer . parse int(arr[2]);
int month = trans(arr[2]);
int date = integer . parse int(arr[0]);
int hour = integer . parse int(arr[3])。 Replace ("am", ""). Replace ("pm", "");
int minute = integer . parse int(arr[4]);
int second = integer . parse int(arr[5]);
Gregorian calendar cal = new Gregorian calendar();
Cal.set (year, month, day, hour, minute, second);
System.out.println (new simple date format ("yyyy-MM-dd HH:mm:ss"). format(cal . gettime());
}
}
- Previous article:Palace ladies talk about the complete works of txt
- Next article:January pinyin
- Related articles
- What is the setback of Song PRO's low-speed oil collection?
- Kindergarten "beginning of winter" solar term activity plan, with children to start a winter trip.
- Excellent composition of food festival
- What words have the same meaning in reverse?
- Excellent components of rainwater
- What does the climate effect of Dongjiang Lake mean?
- Where can I find the material for the short video?
- What are the poems about the first frost in the twenty-four solar terms?
- In ancient times, which solar term did the Asian Year refer to?
- Yeah, yeah, illustration style-looking for an antique painter