-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtime_encrypto.java
46 lines (40 loc) · 1.32 KB
/
time_encrypto.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.text.DateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
// import com.sun.xml.internal.ws.spi.db.TypeInfo;
// import com.sun.glass.ui.Pixels.Format;
// import com.sun.xml.internal.ws.util.StringUtils;
import java.time.LocalDateTime;
/**
* time_encrypto
*/
public class time_encrypto {
static String gettime(){
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd-HH:mm:ss.SSS"));
return now;
}
static String getdate(){
String date = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
return date;
}
static String gettimeonly(){
String time = LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss.SSS"));
return time;
}
/*static void gethouronly(){
LocalDate time = LocalDate.now();
System.out.println(time.getDayOfWeek());
System.out.println(time.getMonth());
//prebuild hash can be added with it . Have to check this :)
System.out.println(time.hashCode());
}*/
public static void main(String[] args) {
getdate();
gettime();
gettimeonly();
//gethouronly();
// Added to encrypt the time
// StringUtil new1 = new StringUtils(dtf.format(now));
// System.out.println(new1);
}
}