Код:
public class TestPayments extends GlobalScriptBase {
@Override
public void execute(Setup setup, ConnectionSet connectionSet)
throws Exception {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMMM YYYY", myDateFormatSymbols);
Connection con = connectionSet.getConnection();
Date nowDate = new Date();
print(nowDate);
print(dateFormat.format(nowDate));
}
private static DateFormatSymbols myDateFormatSymbols = new DateFormatSymbols(){
@Override
public String[] getMonths() {
return bitel.billing.common.TimeUtils.monthNamesRod;
}
};
}
Код:
Mon Dec 26 14:08:17 MSK 2016
26 декабря 2017
Код:
@Override
public void execute(Setup setup, ConnectionSet connectionSet)
throws Exception {
SimpleDateFormat dateFormatYYYY = new SimpleDateFormat("dd MMMM YYYY", myDateFormatSymbols);
SimpleDateFormat dateFormatyyyy = new SimpleDateFormat("dd MMMM yyyy", myDateFormatSymbols);
Connection con = connectionSet.getConnection();
Date nowDate = new Date();
print(nowDate);
print(dateFormatYYYY.format(nowDate));
print(dateFormatyyyy.format(nowDate));
}
private static DateFormatSymbols myDateFormatSymbols = new DateFormatSymbols(){
@Override
public String[] getMonths() {
return bitel.billing.common.TimeUtils.monthNamesRod;
}
};
Код:
Mon Dec 26 14:16:50 MSK 2016
26 декабря 2017
26 декабря 2016
Цитата:
A common mistake is to use YYYY. yyyy specifies the calendar year whereas YYYY specifies the year (of “Week of Year”), used in the ISO year-week calendar. In most cases, yyyy and YYYY yield the same number, however they may be different. Typically you should use the calendar year.