I want to parse few date format using following ANTLR4 grammar.
grammar Variables;
//varTable : tableNameFormat dateFormat? ;
//tableNameFormat: (ID SEPERATO
I never worked on Antlr before, but when I looked in GitHub if someone already did which I want. Found this library.
here is a library to parse the date from String.
https://github.com/masasdani/nangka
add this project as a dependency of your project
com.masasdani
nangka
0.0.6
Sample usage :
String exprEn = "a month later, 20-11-90";
Nangka nangka = new Nangka();
DateUnit dateUnit = nangka.parse(exprEn);
for(Date date : dateUnit.getRelatedDates()){
System.out.println(date);
}
Hope this helps someone like me who is searching.