Java等效于.NET的DateTime.Parse? [英] Java Equivalent to .NET's DateTime.Parse?

查看:105
本文介绍了Java等效于.NET的DateTime.Parse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个我将与Pervasive Data Profiler一起使用的java类,需要检查Date String是否可以与.NET的DateTime.Parse一起使用。



有没有相当的类或第三方库可以给我这个功能非常接近.NET的DateTime.Parse?



我需要它能够处理广泛的日期格式。
ex。 12/20/2008,1/1/08,5/10/2009 12:46:00 AM,5/10/2009 17:46:00

解决方案

请参阅 parse 方法在 DateFormat 类。这是一个示例

  DateFormat df = new SimpleDateFormat(yyyy-MM-dd); 
日期date = df.parse(2001-01-01);


I'm working on a java class that I will use with Pervasive Data Profiler that needs to check if a Date String will work with .NET's DateTime.Parse.

Is there an equivalent class or 3rd party library that can give me this functionality that is very close to .NET's DateTime.Parse?

I would need it to be able to handle a broad range of date formats. ex. "12/20/2008", "1/1/08", "5/10/2009 12:46:00 AM", "5/10/2009 17:46:00"

解决方案

See parse method in DateFormat Class. Here is a sample

DateFormat df = new SimpleDateFormat ("yyyy-MM-dd");
Date date = df.parse("2001-01-01");

这篇关于Java等效于.NET的DateTime.Parse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆