When I create a new Date
object, it is initialized to the current time but in the local timezone. How can I get the current date and time in GMT?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Use this Class to get ever the right UTC Time from a Online NTP Server:
And use it with:
If you need UTC Time "now" as DateTimeString use function:
and use it with:
This works for getting UTC milliseconds in Android.
Here an other suggestion to get a GMT Timestamp object:
Output:
You can change the date format as needed.
You can directly use this