Java: Timezone why different timezone give same value in millisec

前端 未结 3 1676
清歌不尽
清歌不尽 2020-12-03 15:05

I have following code, my target is going to return GMT+0 time in millisec. But Why I always get my local timezone millisec?

Calendar cal         


        
3条回答
  •  萌比男神i
    2020-12-03 15:19

    The millisec of a Date object in Java is just the milliseconds since GMT+0 1970/01/01 00:00:00. It's independent of the Time Zone. Time Zone is a property to format the Date to a readable string.

提交回复
热议问题