feiyu02
2023-10-20 3371ed856d8712732b3f46e30e41e652ff5d7781
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.flightfeather.monitor;
 
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
 
@SpringBootTest
class QianduanApplicationTests {
 
    @Test
    void contextLoads() throws ParseException {
 
            String oldDateStr ="2023-05-01T16:00:00.000Z";
            Date date1 = null;
            SimpleDateFormat df2 = null;
 
                oldDateStr = oldDateStr.replace("Z", " UTC");
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
                Date date = df.parse(oldDateStr);
                SimpleDateFormat sdf = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
                date1 = sdf.parse(date.toString());
                df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
            System.out.print(date1);
            //return df2.format(date1);
 
    }
 
 
//    @Test
//    void exceeding(){
//
//    }
 
}