-
Notifications
You must be signed in to change notification settings - Fork 3
/
CustomYourdate.java
70 lines (54 loc) · 1.69 KB
/
CustomYourdate.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package Example.current;
import com.hosseini.persian.dt.PersianDT;
import com.hosseini.persian.dt.PersianDate.Generate;
import java.util.Date;
/**
* Created by abbas on 3/30/16.
*/
public class CustomYourdate {
public static void main(String[] strings) {
new CustomYourdate().date();
}
public void date() {
Generate current = PersianDT
.Instance()
.generate(new Date(), "{DATE}")
.Separator("-");
System.out.println(
String.format(
"%s/%s/%s",
current.getYear(),
//return Month as int
current.getJustMonthDigit(),
current.getDayDigit()
)
);
System.out.println(
String.format(
"%s-%s-%s",
current.getYear(),
//return Month as String
current.getDayName(),
current.getJustMonthDigit())
);
System.out.println(
String.format(
"%s-%s-%s -> %s",
current.getYear(),
//return Month as String
current.getJustMonthDigit(),
current.getDayDigit(),
current.getDayName()
)
);
System.out.println(
current.getWithMonthName()
);
System.out.println(
current.getWithFullDateInDigits()
);
System.out.println(
current.getMonthAndDay()
);
}
}