The example below shows date formatting and text localization. A custom message is supplied to the localize() method.
public String getLastPublishedOnString() {
Date lastPublished = new Date();
String localizedDate = platform.getUtilityService().formatDateByUserSetting(lastPublished);
return platform.getInternationalizationService().localize("customKey.publishedDateMessage", localizedDate);
}