GWT-日期验证

GWT-日期验证,gwt,Gwt,谁能告诉我如何在GWT中进行日期验证。我以字符串形式传递日期。应将其转换为日期格式,并验证其格式。您可以对字符串使用模式匹配表达式: @Pattern( regexp = "some javascript regular expression" ) private String dateStr; 或者,当您有日期时: @DateTimeFormat(pattern = "dd.MM.yy") private Date myStartDate; 我不使用这个,但您可以在gwt-2.5.0 s

谁能告诉我如何在GWT中进行日期验证。我以字符串形式传递日期。应将其转换为日期格式,并验证其格式。

您可以对字符串使用模式匹配表达式:

@Pattern( regexp = "some javascript regular expression" ) 
private String dateStr;
或者,当您有日期时:

@DateTimeFormat(pattern = "dd.MM.yy")
private Date myStartDate;
我不使用这个,但您可以在gwt-2.5.0 samples目录中看到完整的示例

祝您玩得愉快。

您可以对字符串使用模式匹配表达式:

@Pattern( regexp = "some javascript regular expression" ) 
private String dateStr;
或者,当您有日期时:

@DateTimeFormat(pattern = "dd.MM.yy")
private Date myStartDate;
我不使用这个,但您可以在gwt-2.5.0 samples目录中看到完整的示例

祝您玩得愉快。

导入com.google.gwt.i18n.client.DateTimeFormat;
...
DateTimeFormat myDateTimeFormat=DateTimeFormat.getFormat(…);
Date Date=myDateTimeFormat.parseStrict(日期字符串);
parseStrict()
为无效的日期字符串抛出IllegalArgumentException。

import com.google.gwt.i18n.client.DateTimeFormat;
...
DateTimeFormat myDateTimeFormat=DateTimeFormat.getFormat(…);
Date Date=myDateTimeFormat.parseStrict(日期字符串);

parseStrict()
为无效的日期字符串抛出IllegalArgumentException。

使用哪种语言?java,C++,c++?@ USE3543GWT编程语言是java!为什么要验证转换的字符串?使用哪种语言?java,C++,c++?@ USE3543GWT编程语言是java!为什么要验证转换的字符串?