私はこのコードを持っています:
Date now = new Date();
// the string is in UTC format, so a UTC date must be constructed, I don't know if that happens in this format
Date measure = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(utcDateTime);
long diff = now.getTime() - measure.getTime();
if (diff < 1000* 60 * 15) {
// measure is less then 15 minutes recent
do some work
}
差分を取得すると、タイムゾーンが含まれます。Date オブジェクトが内部的に UTC であることはわかっています。
ここで何が問題なのですか?