Java等效于.NET的DateTime.Parse?

编程入门 行业动态 更新时间:2024-10-21 19:32:29
本文介绍了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?

本文发布于:2023-11-17 07:03:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609240.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NET   Java   Parse   DateTime

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!