本文介绍了如何通过键盘接受日期格式如mm / dd / yyyy作为java程序的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写一个程序来验证输入日期格式。我必须通过键盘接受日期格式,如mm / dd / yyyy作为java程序的输入。请告诉我有关如何接受的建议数据 我尝试过: 我想尝试在我的程序中使用简单的日期格式类,但我无法获取数据,所以请帮助我。
解决方案使用扫描程序类 [ ^ ]以字符串形式读取日期, DateFormat.parse [ ^ ]进行转换。
I am trying to write a program to validate input date format.In that I have to accept the date format like mm/dd/yyyy through keyboard as an input to the java program.so please tell me suggestions regarding how to accept the data What I have tried: I am trying to use simple date format class in my program but i am unable to get the data so please help me.
解决方案 Use the Scanner class[^] to read the date as a string, and DateFormat.parse[^] to convert it.更多推荐
如何通过键盘接受日期格式如mm / dd / yyyy作为java程序的输入
发布评论