DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
You can use a DateFormat to parse also. myDate = df.parse(myString);
Use getDateInstance to get the normal date format for that country. There are other static factory methods available. Use getTimeInstance to get the time format for that country. Use getDateTimeInstance to get a date and time format. You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale, but generally: SHORT is completely numeric, such as 12.13.52 or 3:30pm
MEDIUM is longer, such as Jan 12, 1952
LONG is longer, such as January 12, 1952 or 3:30:32pm
FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.
You can use a DateFormat to parse also. myDate = df.parse(myString);
Use getDateInstance to get the normal date format for that country. There are other static factory methods available. Use getTimeInstance to get the time format for that country. Use getDateTimeInstance to get a date and time format. You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale, but generally: SHORT is completely numeric, such as 12.13.52 or 3:30pm
MEDIUM is longer, such as Jan 12, 1952
LONG is longer, such as January 12, 1952 or 3:30:32pm
FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.
解决方案 »
- 问一个有关于java正则表达式的问题
- 谁能提供一下 testle.jar, 和 stylebook.jar 我找了好久没有找到, 谢谢!
- 请教继承和组合的两个问题
- char[]转byte[]问题?
- 如何获取telnet的数据
- 在学习swing时书上说的“画布”是什么东西?是不是Jpanel呢??
- 为什么这个泛型不成功?
- java做的简易聊天室,基于MySQL数据库,出现一些问题,请大家帮我看看哪里错了。谢谢!!
- 修改程序
- 关于System.in.read()的问题
- 连接sqlserver时出现Microsoft][SQLServer 2000 Driver for JDBC]End of stream was detected on a read. 这种错误是什么原因,谢谢
- 请教jboss3.2.3整合的一个问题
public String toString()
Formats a timestamp in JDBC timestamp escape format. Overrides:
toString in class Date
Returns:
a String object in yyyy-mm-dd hh:mm:ss.fffffffff format得到后根据格式需要来转换就是那!