博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java判断字符串是否日期格式
阅读量:4171 次
发布时间:2019-05-26

本文共 745 字,大约阅读时间需要 2 分钟。

public class Demo {
public static final String[] patterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy/MM/dd","yyyy/MM/dd HH:mm:ss"}; //判断字符串是否为日期格式 public static boolean isDate(String param){
if(param==null) return false; try{
DateUtils.parseDate(param,patterns); }catch (ParseException e){
return false; } return true; } //判断日期字符串能否正确转换格式 public static Date isDate(String param, String pattern){
DateFormat format = new SimpleDateFormat(pattern); if(param==null) return null; try{
return format.parse(param); }catch (ParseException e){
return null; } }}

转载地址:http://vukai.baihongyu.com/

你可能感兴趣的文章
Linux使用技巧VNC
查看>>
PG数据库部署linux参数调整
查看>>
Linux shell正则表达式-sed-awk-grep应用
查看>>
linux系统管理—第五章Linux-bashshell
查看>>
PostgreSQL数据库管理 第二章体系结构
查看>>
PostgreSQL数据库管理 第三章实例管理与管理工具
查看>>
PostgreSQL数据库管理第七章流复制
查看>>
PostgreSQL数据库管理第十章Repmgr
查看>>
PostgreSQL数据库管理 第八章日常运维
查看>>
PostgreSQL数据库管理 第五章表空间管理
查看>>
PostgreSQL数据库管理第九章备份恢复
查看>>
PostgreSQL数据库管理数据导入导出
查看>>
MySQL数据库管理-体系结构
查看>>
MySQL数据库部署linux参数调整
查看>>
MySQL数据库管理-安装
查看>>
MySQL数据库单进程多线程数据库
查看>>
Linux系统管理系统性能分析nmon
查看>>
Linux系统管理系统性能分析
查看>>
MySQL数据库文件管理
查看>>
MySQL数据库字符集管理
查看>>