0
我在我的JHipster應用程序中有以下代碼。當我在筆記本電腦上本地運行時,它給了我正確的時區。是否有可能在JHipster應用程序中獲取用戶的時區?
@RequestMapping(value = "/points-this-week",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<PointsPerWeek> getPointsThisWeek(TimeZone timeZone) {
DateTimeZone usersTimeZone = DateTimeZone.forID(timeZone.getID());
log.debug("Getting points for week with timezone: {}", usersTimeZone);
// Get current date
LocalDate now = new LocalDate(usersTimeZone);
然而,在Heroku上運行時,timeZone.getID()
是 「ETC/UTC」。是否有可能在JHipster應用程序中獲得客戶的時區?