相当于Java与.NET的DateTime.Parse?NET、Java、Parse、DateTime

2023-09-04 23:54:55 作者:此id已被河蟹

我的工作,我会与需要检查,如果日期字符串将与.NET的DateTime.Parse普及型数据探查使用的Java类。

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.

是否有一个等价类或第三方库,可以给我这个功能,这是非常接近.NET的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?

我需要它能够处理广泛的日期格式。 恩。 二零零八年十二月二十零日,1/1/08,2009年5月10日上午12点46分00秒,5/10/2009 17:46:00

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"

推荐答案

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

See parse method in DateFormat Class. Here is a sample

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