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!
分享到:
相关推荐
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 ...
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 ...
However, this abundance of resources inevitably leads to conflicts in usage and waste, particularly in the case of badminton resources that this study focuses on. To address this issue, I propose ...
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 ...
“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. ...
- **Basic System Settings**: Discussion of configuring basic settings such as date and time, regional settings, and power management. - **Advanced System Configuration**: In-depth coverage of more ...
The book covers the syntax and usage of `sprintf` and the time formatting options. - **Interactive Ruby (irb) and the Ruby Debugger:** irb is an interactive shell for experimenting with Ruby code. ...
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 ...
ls -t (time)按修改时间排序,显示目录和文件。 ls -lt 是“-l”和“-t”的组合,按时间顺序显示列表。 ls -F 显示文件类型,目录“/ ”结尾;可执行文件“*”结尾;文本文件(none),没有结尾。 ls -R 递归显示...
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 ...
The BL0940 electric parameter monitoring module plays a crucial role in capturing real-time data about the electrical conditions in the classroom, allowing for efficient energy management and ...
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....
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 = ...
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 ...
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...
4. **Date and Time API**: Java 8 overhauls the date and time handling with the introduction of the `java.time` package, replacing the older `java.util.Date` and `java.util.Calendar`. The new API is ...
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
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 ...