当前位置 博文首页 > instantget好用吗Java Instant getNano()用法及代码示例

    instantget好用吗Java Instant getNano()用法及代码示例

    作者:xiaoyingying 时间:2021-08-14 18:35

        IIS7批量FTP管理功能说明:
        1、可批量导入,导出FTP信息
        2、其他ftp工具有的功能,我们也有
        3、特色功能:可以定时上传下载
        4、数据信息列表化、一眼就能知道那个是那个
        5、批量连接标签页式切换方便快捷
        6、7大连接模式更多好的兼容
        7、内嵌编辑器有效解决普通txt记事本乱码
        8、锁屏功能当程序有规定时间内没人操作,则自动锁程序。输入密码才可以正常操作
        本产品适用于:懒得记录FTP信息和有批量定时备份,上传下载的运维或站长。
        下载地址:http://ftp.iis7.com/
        图片:
        Instant类的getNano()方法用于从第二秒开始在此瞬间表示的时间轴中返回纳秒数。nanosecond-of-second值,它测量从getEpochSecond()返回的第二个值起的纳秒总数。
        用法:
        publicintgetNano()
        返回值:此方法返回第二个值内的纳秒,该值始终为正,并且永远不会超过999、999、999。
        以下示例程序旨在说明getNano()方法:
        示例1:
        //Javaprogramtodemonstrate
        //Instant.getNano()method
        importjava.time.*;
        publicclassGFG{
        publicstaticvoidmain(String[]args)
        {
        //createaInstantobject
        Instantinstant
        =Instant.parse("2018-12-30T19:34:50.63Z");
        //getnanosecondofsecondsecondvalue
        //usinggetNano()
        intvalue=instant.getNano();
        //printresult
        System.out.println("nanosecondsvalue:"
        +value);
        }
        }
        输出:
        nanosecondsvalue:630000000
        示例2:
        //Javaprogramtodemonstrate
        //Instant.getNano()method
        importjava.time.*;
        publicclassGFG{
        publicstaticvoidmain(String[]args)
        {
        //createaInstantobject
        Instantinstant=Instant.now();
        //currentInstant
        System.out.println("CurrentInstant:"
        +instant);
        //getnanosecondofsecondsecondvalue
        //usinggetNano()
        intvalue=instant.getNano();
        //printresult
        System.out.println("nanosecondsvalue:"
        +value);
        }
        }
        输出:
        CurrentInstant:2018-11-27T04:21:27.029Z
        nanosecondsvalue:29000000
        参考:https://docs.oracle.com/javase/10/docs/api/java/time/Instant.html#getNano()
        原文链接:https://vimsky.com/examples/usage/instant-getnano-method-in-java-with-examples.html