gpt4 book ai didi

java - 毫秒的数据类型

转载 作者:行者123 更新时间:2023-11-29 07:58:45 26 4
gpt4 key购买 nike

我的应用程序中有一个时间测量系统,我的毫秒数为 LONG 数据类型。

现在,我希望将它们转换为秒,除以 1000 很容易。

我需要的是毫秒的小数位。我如何获得它?

最佳答案

long seconds = timeInMillis/1000;
long milliseconds = timeInMillis%1000;

double timeInSeconds = ((double)seconds) + (((double)milliseconds)/1000.0);

关于java - 毫秒的数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15864268/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com