feiyu02
2023-08-08 159f964a5f717b2c22f8aea29d1a7be2b8fdbac3
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
package com.job.zsc;
 
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);
 
    }
 
}