| @@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; | |||||
| import org.apache.http.Consts; | import org.apache.http.Consts; | ||||
| import org.apache.http.HttpEntity; | import org.apache.http.HttpEntity; | ||||
| import org.apache.http.HttpResponse; | import org.apache.http.HttpResponse; | ||||
| import org.apache.http.ParseException; | |||||
| import org.apache.http.client.methods.HttpPost; | import org.apache.http.client.methods.HttpPost; | ||||
| import org.apache.http.entity.StringEntity; | import org.apache.http.entity.StringEntity; | ||||
| import org.apache.http.impl.client.CloseableHttpClient; | import org.apache.http.impl.client.CloseableHttpClient; | ||||
| @@ -15,6 +14,7 @@ import org.apache.http.protocol.HTTP; | |||||
| import org.apache.http.util.EntityUtils; | import org.apache.http.util.EntityUtils; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.text.ParseException; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
| import java.time.format.DateTimeFormatter; | import java.time.format.DateTimeFormatter; | ||||
| @@ -59,28 +59,12 @@ public class CYFUtil { | |||||
| * @Author furunxin | * @Author furunxin | ||||
| * @Date 2020/7/8 下午12:45 | * @Date 2020/7/8 下午12:45 | ||||
| **/ | **/ | ||||
| public static Date utcToLocal(String utcTime){ | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
| sdf.setTimeZone(TimeZone.getTimeZone("UTC")); | |||||
| Date utcDate = null; | |||||
| try { | |||||
| utcDate = sdf.parse(utcTime); | |||||
| } catch (ParseException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (java.text.ParseException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| sdf.setTimeZone(TimeZone.getDefault()); | |||||
| Date locatlDate = null; | |||||
| String localTime = sdf.format(utcDate.getTime()); | |||||
| try { | |||||
| locatlDate = sdf.parse(localTime); | |||||
| } catch (ParseException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (java.text.ParseException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return locatlDate; | |||||
| public static Date utcToLocal(String seconds) throws ParseException { | |||||
| String format = "yyyy-MM-dd HH:mm:ss"; | |||||
| SimpleDateFormat sdf = new SimpleDateFormat(format); | |||||
| String d = sdf.format(new Date(Long.valueOf(seconds+"000"))); | |||||
| Date date=sdf.parse(d); | |||||
| return date; | |||||
| } | } | ||||
| public static String getLocalDate(){ | public static String getLocalDate(){ | ||||