当前位置:网站首页>[Method for converting timestamp to normal time format]
[Method for converting timestamp to normal time format]
2022-08-08 21:02:00 【child running in the sun】
I encountered the problem of converting the timestamp to the normal time format in the project, record it here:
public class DateUtil {public static String timeStamp2Date(String time){Long timeLong = Long.parseLong(time);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//The time format to be convertedDate date;try {date = sdf.parse(sdf.format(timeLong));return sdf.format(date);} catch (ParseException e) {e.printStackTrace();return null;}}}
Method call
String time = DateUtil.timeStamp2Date(result.getString("WEATHER_DATE"))
Thanks for reading.
边栏推荐
猜你喜欢
学习笔记:2.3 静态链表 循环链表 双向链表
昇腾Ascend 随记 —— TensorFlow 模型迁移
Use fontforge to modify font, keep only numbers
安全策略及电商购物订单简单用例
门外汉掌握数据分析处理技术的路线图
推荐7款好用的Visual Studio扩展
学习笔记:线性表的顺序表示和实现(二级指针实现)
Bluu Seafood launches first lab-grown fish products
目标检测论文 Bridng the Gap Between Anchor-based and Anchor-free Detection via ATSS
单片机--IIC总线篇
随机推荐
Bluu Seafood launches first lab-grown fish products
Mysql管理指令
图像噪声水平估计INLE_paper
Protobuf框架与WebAPI
各类测试场景的检查点
Process实现守护线程
Kotlin reflection
go基于泛型实现继承
Redis布隆过滤器
图神经网络GNN简介及应用方向
PHP使用glob()查找文件
Flask 教程 第十三章:国际化和本地化
2020-8-18js练习
phpmyadmin 4.8.1 远程文件包含漏洞(CVE-2018-12613)
Redis Bloom Filter
目标检测论文 Precise detection of Chinese characters in historical documents with DRL
第十三届蓝桥杯(Web 应用开发)线上模拟赛【第十题】(RESTful API 开发)
Kotlin委托属性知识点
SQL注入之搭建dnslog
Kotlin反射