【发布时间】:2011-05-11 18:27:14
【问题描述】:
所以我有这段代码可以返回当前的 EST
Date easternTime = new Date();
DateFormat format = new SimpleDateFormat("h:mm a");
format.setTimeZone(TimeZone.getTimeZone("EST"));
return format.format(easternTime);
假设它返回x = 12:15PM
我想将x 与美国东部标准时间下午 3:00 进行比较,以查看 x 是在美国东部标准时间下午 3:00 之前还是之后,和/或 x 是在美国东部标准时间下午 3:00 到下午 6:00 之间。有没有办法做到这一点。
我们不必使用java.util.date。我也用calendar 解决问题
【问题讨论】: