`
tanglei198577
  • 浏览: 57855 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

The usage of time and date

    博客分类:
  • java
阅读更多

There are some usage of time we often used for developping,here is my submit:

 

one:

    Get the unique value by getTime

   

    import java.sql.Timestamp;

    import java.util.Date;

       Date date=new Date();

       Timestamp st=new Timestamp(date.getTime());

       String uniqueStr="U";

       uniqueStr=uniqueStr+st.getTime(); //the sum of microsecond from 1970

 

two :

    The transition of Date and String()

   

public class StringToDate {

    public static Date stringToDate(String dateString){

      Date date;

       try {

           date = new SimpleDateFormat("yyyy-MM-dd").parse(dateString);

           return date;

       } catch (ParseException e) {

           // TODO Auto-generated catch block

           e.printStackTrace();

           return null;

       }

    }

 Three, when we want to calculate the time of execution of our program:

long startTime = System.currentTimeMillis();
long endTime = System.currentTimeMillis();
System.out.println("The time used is "+(endTime-startTime)+" ms");

 

If you have some good methods of time ,pls share it!

分享到:
评论

相关推荐

    The Art of Assembly Language Programming

    You are visitor as of October 17, 1996. The Art of Assembly Language Programming <br>Forward Why Would Anyone Learn This Stuff? 1 What's Wrong With Assembly Language 2 What's Right With ...

    Cheat engine help manual

    This help file is intended to familiarize you with the basic features and usage of Cheat Engine. Some examples for various things are given, but a lot of the actual 'gamehacking' is out of the scope ...

    Firefox and Thunderbird Garage

    According to spreadfirefox.com, to-date there have been ~ 23 million downloads since the release of Firefox 1.0 in September 2004, and MS IE usage has been dropping at the same time. Thunderbird has ...

    polycom宝利通视频会议软件3.9 2018

    “SUBSCRIPTION PERIOD” means the period of time you have licensed the SOFTWARE PRODUCT, beginning upon LICENSE ACTIVATION and ending after the duration listed in your AUTHORIZED PURCHASE ORDER. ...

    二级减速器课程设计说明书reducer design specification.doc

    According to the selected fullload speed of the motor nm and the drive shaft speed of the motor nw,we can calculate the total transmission ratio of the transmission device ia: (2)Allocate ...

    spssw-184.zip

    Although myths and speculation about a Terra Australis (Southern Land) date back to antiquity, the first confirmed sighting of the continent is commonly accepted to have occurred in 1820 by the ...

    OpenGL SuperBible 5th Edition.pdf

    Readers will find up-to-date, hands-on guidance on all facets of modern OpenGL development, including transformations, texture mapping, shaders, advanced buffers, geometry management, and much more....

    Android代码-时间选择器,选择特定间隔时间段。

    And note that, it utilizes Joda-Time to process some date time logic under the hood. So you might need to set up Joda-Time properly. With start and end date times specified: val intent = ...

    微软内部资料-SQL性能优化3

    In our example, if one transaction (T1) holds an exclusive lock at the table level, and another transaction (T2) holds an exclusive lock at the row level, each of the transactions believe they have ...

    More.Math.Into.LaTeX.3319237950

    In this carefully revised fifth edition, the Short Course has been brought up to date and reflects a modern and practical approach to LaTeX usage. New chapters have been added on illustrations and how...

    Android代码-ThreeTenABP

    ThreeTen Android Backport ...for the ailing Date and Calendar APIs in both Java and Android. JSR-310 was backported to Java 6 by its creator, Stephen Colebourne, from which this library i

    Learning.JavaScript.Add.Sparkle.and.Life.to.Your.Web.Pages.3rd.Edition.14

    Date and Time Chapter 16. Math Chapter 17. Regular Expressions Chapter 18. JavaScript in the Browser Chapter 19. jQuery Chapter 20. Node Chapter 21. Object Property Configuration and Proxies Chapter ...

    VB编程资源大全(英文源码 网络)

    iusage.zip NO its not another internet usage monitor its different.Apart from calculating the cost and total time you spend on the net it even reminds you to switch of the net after a time ...

    The GNU C Library

    * 21 Date and Time * 22 Resource Usage And Limitation * 23 Non-Local Exits * 24 Signal Handling * 25 The Basic Program/System Interface * 26 Processes * 27 Job Control * 28 System Databases ...

    Packt.Python.Journey.from.Novice.to.Expert.2016

    Learn the trickier aspects of Python and put it in a structured context for deeper understanding of the language Who This Book Is For This course is meant for programmers who wants to learn Python ...

    rfc全部文档离线下载rfc1-rfc8505

    the IMPs and it is the responsibility of the HOST groups to agree on HOST software. During the summer of 1968, representatives from the initial four sites met several times to discuss the HOST ...

    HDVsplit DV采集软件

    0001 ("Count" option) or add date and time to the end of file name e.g. 2005_10_12-12_10_42 ("Date and time" option) 7. You can change the date and time format. Input any text, which is proper for ...

    ModernGadgets_1.6.3.rmskin

    - Displays current date and time - Shows system uptime and logon time - Supports up to two alarms - Displays a custom event countdown - Includes stopwatch and timer applets - Able to be scaled to...

    Xcode.5.Start.to.Finish.iOS.and.OS.X.Development

    By the time you’re finished, you’ll have the advanced Xcode skills to develop outstanding software. Coverage includes Setting breakpoints and tracing execution for active debugging Creating ...

    PostgreSQL 9.0 High Performance

    PostgreSQL database servers have a common set of problems they encounter as their usage gets heavier and requirements more demanding. You could spend years discovering solutions to them all, step by ...

Global site tag (gtag.js) - Google Analytics