Convert Current date to integer

前端 未结 12 911
轮回少年
轮回少年 2020-12-05 04:35

I want to convert the current date to integer value. By default, it returns long. When I try to convert long to integer, and afterwards I convert the integer value to date,

12条回答
  •  醉酒成梦
    2020-12-05 04:40

    Your Problem is because of getTime() . it always return following.

    Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

    Because the max integer value is less then the return value by getTime() that why is showing wrong result.

提交回复
热议问题