停止使用Java语言在Android Studio中使用当前时间的观看

发布于 2025-01-22 02:40:46 字数 1455 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆躺在深渊里 2025-01-29 02:40:46

用当前时间进行停止观看

Instant.now().toString()

或:

ZonedDateTime.now().format( DateTimeFormatter.ofLocalizedDateTime( FormatStyle.LONG ) )

从当前设备时间开始计算时间

Instant start = Instant.now() ;

当我单击停止时应停止

Instant end = Instant.now() ;

计算开始和停止时间之间的差异。

Duration elapsed = Duration.between( start , end ) ;

显示时间是15分钟的工作

long minutesElapsed = elapsed.toMinutes() ;

当前开始和停止时间。

DateTimeFormatter f = DateTimeFormatter.ofLocalizedDateTime( FormatStyle.FULL ) ;
String output = 
    start.atZone( ZoneId.systemDefault() ).format( f ) +
    " to " +
    end.atZone( ZoneId.systemDefault() ).format( f ) +
    " is " +
    minutesElapsed +
    " minutes."
;
    

make stop watch with current time

Instant.now().toString()

Or:

ZonedDateTime.now().format( DateTimeFormatter.ofLocalizedDateTime( FormatStyle.LONG ) )

start calculation time from current device time

Instant start = Instant.now() ;

when i click on stop ut should stop

Instant end = Instant.now() ;

calculating difference between start and stop time.

Duration elapsed = Duration.between( start , end ) ;

show the time is 15 minute of work

long minutesElapsed = elapsed.toMinutes() ;

with current start and stop time.

DateTimeFormatter f = DateTimeFormatter.ofLocalizedDateTime( FormatStyle.FULL ) ;
String output = 
    start.atZone( ZoneId.systemDefault() ).format( f ) +
    " to " +
    end.atZone( ZoneId.systemDefault() ).format( f ) +
    " is " +
    minutesElapsed +
    " minutes."
;
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文