PesianDate for JAVA 📅
persianDT its for guys WANT date in PERSIN LANGUAGE more readable and freindly and most important easy use generate and create such dates for them. you can access date in two ways :
- Asynchorouns
- synchronous
and PersianDT is ThreadSafe and its build on top of 3 design pattern
- CallBack Pattern
- Builder Pattern
- Singleton Pattern
- can create dates direclty from System
- can Create dates from Given date
- You can put anywhere in the string you want
- Paragrph
- Sentence
- WebPage
- WhatEver
- Can Custom your date if you want
- Can you use MarkDown
{DATE}
to Specified where you want date to be displayed - Text/String - can you create date in Ago Format like
2016 Apr 1
become1 day ago
so if you wanna get reponse Asynchronous You have to use CallBack Interface
and for using it you have to know how
in PersianDt you can fill and get response in couple of ways like :
- implement CallBack
- Lambda/Method Refernce (JAVA8)
- Anonymous implement
if you have any trouble Read JavaDoc!
Current Class Deprecated
//implement CallBack
public class useItEasyWayLikeBuilderpattern implements CallBack {
public static void main(String[] strings) {
new useItEasyWayLikeBuilderpattern().date();
}
public void date() {
PersianDT
.Instance()
.generate(new Date(),"Current persian date in your device is {DATE} witout year.")
.CallBack(this)
.generateWithoutYear();
}
@Override
public void onReceive(String date) {
System.out.println(date);
}
// in java 8
int random = new Random().nextInt(12);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, random);
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
//Lambda
PersianDT
.Instance()
.generate(format, "{DATE}")
.CallBack(date -> System.out.println(date))
.Separator("_")
.generateFullDate();
//method reference
PersianD
.Instance()
.generate(format, "{DATE}")
.CallBack(System.out::println)
.Separator("--")
.generateWithMonthName();
//Anonymous implement
PersianDT
.Instance()
.generate(format, "{DATE}")
.CallBack(new CallBack() {
@Override
public void onReceive(String date) {
System.out.println(date);
}
})
.Separator(" | ")
.generateWithMonthName();
PersianDT
.Instance()
.generate(format, "{DATE}")
.CallBack(System.out::println)
.Separator("--")
.generateWithMonthName();
you can see (BuilderPattern) Example in here
you can create instance of Generate
class and keep the instance and get any part you want separately
please check this Example
#####you can use it to create appropriate instance :
Example 1- Customize your date
Example 2- Customize your date
#####Create date in Ago Format :
download the jar file from HERE
###License Copyright (C) 2016 AbbasHosseini
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.