没有可用于java.text.SimpleDataFormat类型的源代码:GWT编译错误

没有可用于java.text.SimpleDataFormat类型的源代码:GWT编译错误,java,gwt,Java,Gwt,我正在尝试制作一个GWT应用程序。然后我在客户端和共享端使用SimpleDataFormat类时出现了一些错误 [ERROR] [gwtfirst] Line 381: No source code is available for type java.text.SimpleDateFormat; did you forget to inherit a required module? 以下是我在客户端的代码: SimpleDateFormat sdf = new SimpleDateForm

我正在尝试制作一个GWT应用程序。然后我在客户端和共享端使用SimpleDataFormat类时出现了一些错误

[ERROR] [gwtfirst] Line 381: No source code is available for type java.text.SimpleDateFormat; did you forget to inherit a required module?
以下是我在客户端的代码:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
Window.alert(sdf.format(usersList.get(30).getCreatedate()));
但是我可以在服务器端使用SimpleDataFormat。。。
我想知道是否不能在客户端或共享端使用SimpleDataFormat?

SimpleDataFormat
在GWT中不可用。改用。

我不知道这是否是我的代码的问题,因为它一直工作了一整天。我从未改变过那个密码。。。刚刚停止编译…

GWT不包含SimpleDataFormat,而是包含DateTimeFormat 所以你可以用

 DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("YYYY/MM/DD") 
 Date date = dateTimeFormat.parse(str);

如需了解更多信息,请阅读“com.google.gwt.i18n.client.DateTimeFormat”。

@tibtof,如果您是对的。只是对Mozzan做了一点补充-您可以在服务器端使用SimpleDataFormat。只是不在客户端。