List of usage examples for java.text DateFormat LONG
int LONG
To view the source code for java.text DateFormat LONG.
Click Source Link
From source file:com.job.portal.HomeController.java
@RequestMapping(value = "/test", method = RequestMethod.GET) public String home(Locale locale, Model model) { System.out.println("Welcome Client krish change " + locale.getCountry()); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate); return "home"; }
From source file:com.vityuk.ginger.provider.format.JdkDateUtils.java
private static int createJdkDateStyleCode(DateFormatStyle formatStyle) { switch (formatStyle) { case SHORT:/*from www . j a v a 2s . c o m*/ return DateFormat.SHORT; case MEDIUM: return DateFormat.MEDIUM; case LONG: return DateFormat.LONG; case FULL: return DateFormat.FULL; case DEFAULT: return DateFormat.DEFAULT; default: throw new IllegalArgumentException(); } }
From source file:org.openmrs.util.Format.java
public static String format(Date date, Locale locale, FORMAT_TYPE type) { log.debug("Formatting date: " + date + " with locale " + locale); DateFormat dateFormat = null; if (type == FORMAT_TYPE.TIMESTAMP) { dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); } else if (type == FORMAT_TYPE.TIME) { dateFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale); } else {//w w w . ja va 2 s .c o m dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, locale); } return date == null ? "" : dateFormat.format(date); }
From source file:com.truthbean.demo.ssm.controller.HomeController.java
/** * Simply selects the home view to render by returning its name. *//* w w w .j a v a2s . c om*/ @RequestMapping(value = "/index.html", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); System.out.println(formattedDate); model.addAttribute("serverTime", formattedDate); return "view/home"; }
From source file:DateFormatDemo.java
static public void showBothStyles(Locale currentLocale) { Date today;// ww w . ja va2 s . c o m String result; DateFormat formatter; int[] styles = { DateFormat.DEFAULT, DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, DateFormat.FULL }; System.out.println(); System.out.println("Locale: " + currentLocale.toString()); System.out.println(); today = new Date(); for (int k = 0; k < styles.length; k++) { formatter = DateFormat.getDateTimeInstance(styles[k], styles[k], currentLocale); result = formatter.format(today); System.out.println(result); } }
From source file:lucee.commons.i18n.FormatUtil.java
public static DateFormat[] getDateTimeFormats(Locale locale, TimeZone tz, boolean lenient) { String id = "dt-" + locale.hashCode() + "-" + tz.getID() + "-" + lenient; DateFormat[] df = formats.get(id); if (df == null) { List<DateFormat> list = new ArrayList<DateFormat>(); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale)); add24(list, locale);//from w ww .ja v a 2 s . c om addCustom(list, locale, FORMAT_TYPE_DATE_TIME); df = list.toArray(new DateFormat[list.size()]); for (int i = 0; i < df.length; i++) { df[i].setLenient(lenient); df[i].setTimeZone(tz); } formats.put(id, df); } return df; }
From source file:org.croodie.resource.RootServerResource.java
@Get("json") public String represent() { Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.getDefault()); String formattedDate = dateFormat.format(date); return formattedDate; }
From source file:com.google.code.gerrytan.jsonsimple.HomeController.java
/** * Simply selects the home view to render by returning its name. *//*from www . j a v a2 s. com*/ @RequestMapping(value = "/home", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! the client locale is " + locale.toString()); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate); return "home"; }
From source file:org.openinfinity.web.controller.HomeController.java
/** * Simply selects the home view to render by returning its name. *//* w w w . ja v a 2s .c o m*/ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { LOGGER.info("Welcome home! the client locale is " + locale.toString()); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate); return "home"; }
From source file:com.gelecekonline.web.HomeController.java
/** * Simply selects the home view to render by returning its name. *//*w w w . j a va 2s .c o m*/ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! the client locale is " + locale.toString()); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate); return "home"; }