Example usage for java.text DateFormat LONG

List of usage examples for java.text DateFormat LONG

Introduction

In this page you can find the example usage for java.text DateFormat LONG.

Prototype

int LONG

To view the source code for java.text DateFormat LONG.

Click Source Link

Document

Constant for long style pattern.

Usage

From source file:es.ucm.fdi.dalgs.web.MainController.java

/**
 * Simply selects the home view to render by returning its name.
 *//*from   w ww  . j a  va 2 s. c  om*/
@Secured({ "ROLE_USER", "ROLE_ADMIN" })
@RequestMapping(value = "/home.htm", 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);
    model.addAttribute("class", "User");
    model.addAttribute("serverTime", formattedDate);

    return "home";
}

From source file:edu.illinois.my.wiki.services.WikiLocationImpl.java

@Override
public String getLastModificationDateString() {
    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT);
    Date modifiedDate = getLastModificationDate();
    return formatter.format(modifiedDate);
}

From source file:ph.fingra.statisticsweb.controller.HomeController.java

/**
 * Simply selects the home view to render by returning its name.
 *//*from w  ww . jav  a  2 s.  co  m*/
@RequestMapping(value = "/test", method = RequestMethod.GET)
public String test(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);

    model.addAttribute("serverTime", formattedDate);

    // database & mybatis db mapper test
    model.addAttribute("memberlist", memberService.getList());

    // admin.properties test
    Member admin = new Member();
    admin.setEmail(adminEmail);
    admin.setName(adminName);
    admin.setPassword(adminPassword);
    admin.setRole(MemberRole.ROLE_ADMIN.getValue());
    model.addAttribute("admin", admin);

    return "test";
}

From source file:com.satlabs.testbed.HomeController.java

/**
 * Simply selects the home view to render by returning its name.
 *///from w ww.j  a v  a 2s .c  om
@RequestMapping(value = "/", 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);

    model.addAttribute("serverTime", formattedDate);

    return "home";
}

From source file:com.olegchir.fadeok.controller.AppController.java

@RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
public String home(Locale locale, Model model) {

    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.simon.server.controller.HomeController.java

/**
 * Simply selects the home view to render by returning its name.
 *
 * @throws Exception/*w  w  w . ja  v a2s.c  o  m*/
 */
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView home(Locale locale, Model model) throws Exception {

    LOGGER.info(TAG, "Welcome home! The client locale is {}.", locale);
    ModelAndView mav = new ModelAndView();
    mav.setViewName("home");

    Date date = new Date();
    DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);

    String formattedDate = dateFormat.format(date);

    model.addAttribute("serverTime", formattedDate);

    model.addAttribute("peoples", peopleService.getEntityList());

    return mav;
}

From source file:threads.HeapStat.java

/**
 * Creates a new instance of HeapStat// w w w  .ja va2  s  .c o  m
 */
public HeapStat(JProgressBar jpHeap, JProgressBar jpTimeout, JLabel clock, Closure timeoutAction) {
    super();
    this.jpTimeout = jpTimeout;
    this.timeoutAction = timeoutAction;
    uhrzeit = DateFormat.getTimeInstance(DateFormat.SHORT);
    datum = DateFormat.getDateInstance(DateFormat.LONG);
    touch();
    this.clock = clock;
    this.setName("HeapStat");
    this.interrupted = false;
    this.jpHeap = jpHeap;
    this.jpHeap.setStringPainted(true);
}

From source file:com.sonicle.webtop.core.util.AppLocale.java

public AppLocale(String languageTag) {
    this.id = LangUtils.homogenizeLocaleId(languageTag);

    Locale locale = LangUtils.languageTagToLocale(languageTag);
    shortDatePattern = getDateFormatter(DateFormat.SHORT, locale).toPattern();
    longDatePattern = getDateFormatter(DateFormat.LONG, locale).toPattern();
    shortTimePattern = getTimeFormatter(DateFormat.SHORT, locale).toPattern();
    longTimePattern = getTimeFormatter(DateFormat.LONG, locale).toPattern();
}

From source file:org.hyperic.hq.measurement.server.session.ReportStatsCollector.java

@Autowired
public ReportStatsCollector(DiagnosticsLogger diagnosticsLogger, ServerConfigManager serverConfigManager) {
    diagnosticsLogger.addDiagnosticObject(new DiagnosticObject() {
        public String getName() {
            return "Metric Reports Stats";
        }/* ww  w. j a  v  a  2s .c  om*/

        public String getShortName() {
            return "metricReportsStats";
        }

        public String toString() {
            return "ReportStatsCollector";
        }

        public String getStatus() {
            DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
            long start = getCollector().getOldestTime();
            long end = getCollector().getNewestTime();
            long now = System.currentTimeMillis();
            double nMetrics = getCollector().valPerTimestamp(now) * 60;
            PrintfFormat pfmt = new PrintfFormat("%.3f");
            return "Metric Report Data\n" + "    Start:     " + fmt.format(new Date(start)) + "\n"
                    + "    End:       " + fmt.format(new Date(end)) + "\n" + "    Samples:   "
                    + getCollector().getSize() + "\n" + "    Rate:      " + pfmt.sprintf(nMetrics)
                    + " kMetrics / min";
        }

        public String getShortStatus() {
            return getStatus();
        }
    });
    this.serverConfigManager = serverConfigManager;
}

From source file:DateFormatDemo.java

static public void showTimeStyles(Locale currentLocale) {

    Date today = new Date();
    String result;//  w  w  w.ja v a 2  s.co m
    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();

    for (int k = 0; k < styles.length; k++) {
        formatter = DateFormat.getTimeInstance(styles[k], currentLocale);
        result = formatter.format(today);
        System.out.println(result);
    }
}