博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Joda-Time
阅读量:7252 次
发布时间:2019-06-29

本文共 1440 字,大约阅读时间需要 4 分钟。

 

根据Millis计算minutes:

demo:

import org.joda.time.Interval;import org.joda.time.LocalDateTime;/** * Created by tang.cheng on 2017/5/19. */public class Test {    public static void main(String[] args) {        long startTime = LocalDateTime.now().toDate().getTime();        int millis = 1234567890;        System.out.println("plus millis:" + millis);        long endTime = LocalDateTime.now().plusMillis(millis).toDate().getTime();        System.out.println("startTime:" + startTime + " \nendTime:" + endTime);        long totalTime = endTime - startTime;        System.out.println("TotalMillis: " + totalTime);        long l = totalTime / 60 / 1000;        System.out.println("Total minutes:" + l + (millis == totalTime ? "没有精度损失" : "有精度损失"));        Interval interval = new Interval(startTime, endTime);        long standardMinutes = interval.toDuration().getStandardMinutes();        System.out.println("Total minutes:" + standardMinutes);    }}

http://1985wanggang.blog.163.com/blog/static/7763833201371341545546/

http://www.yihaomen.com/article/java/405.htm

 

withMillis

public  withMillis(long newMillis)
Returns a copy of this datetime with different millis.

The returned object will be either be a new instance or this. Only the millis will change, the chronology and time zone are kept.

Parameters:
newMillis - the new millis, from 1970-01-01T00:00:00Z
Returns:
a copy of this datetime with different millis

http://www.joda.org/joda-time/

 

转载地址:http://wiebm.baihongyu.com/

你可能感兴趣的文章
4、jeecg 笔记之 自定义显示按钮 (exp 属性)
查看>>
大白话5分钟带你走进人工智能-第二十八节集成学习之随机森林概念介绍(1)
查看>>
ASPNET MVC Error 403.14
查看>>
redis学习笔记
查看>>
排球计分规则
查看>>
xml解析
查看>>
android分析之Condition
查看>>
创建单例的两种方法
查看>>
Mac上在github 搭建 octopress
查看>>
Elasticsearch增、删、改、查操作深入详解
查看>>
Cocos2d-x内存自动释放机制--透彻篇
查看>>
模板方法模式
查看>>
[mybatis]Example的用法
查看>>
3D跑酷遇到的问题
查看>>
putty 、xshell的使用 和 putty 、xshell、 shell 间免密登陆
查看>>
项目管理之怒目相争,外行能不能领导内行做软件开发?
查看>>
扬帆起航,再踏征程(四)
查看>>
Objective-C基础笔记(2)@property和@synthesize
查看>>
Android系统开发(1)——GCC编译器的编译和安装过程
查看>>
详解Python模块导入方法
查看>>