- Dateクラスで現在時間を入手
- SimpleDateFormatクラスで、表示フォーマットを決定
といった手順をとるのが手っ取り早いが、GWTではSimpleDateFormatが使えない。そこで、com.google.gwt.i18n.client.DateTimeFormatクラスを利用しよう。
詳細は、JavaDocを参照のこと
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date nowTime = new Date(); | |
DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy/MM/d/h:mm"); | |
Window.alert(fmt.format(nowTime)); |