Code example for Locale

Methods: toString

0
	/** 
	 * Simply selects the home view to render by returning its name. 
	 */ 
	@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"; 
	} 
	 
}