Here you can find the source of toDateStringFromResources(String timestamp)
Parameter | Description |
---|---|
timestamp | timestamp of format 20130124101010761 |
public static String toDateStringFromResources(String timestamp)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { /**// ww w. j a va 2 s . c o m * Convert timestamp string into a localised date string * @param timestamp timestamp of format 20130124101010761 * @return */ public static String toDateStringFromResources(String timestamp) { //input SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmss"); Date d = null; try { d = format.parse(timestamp); } catch (ParseException e) { e.printStackTrace(); } //output DateFormat formatter = DateFormat.getDateInstance( DateFormat.MEDIUM, Locale.getDefault()); String s = formatter.format(d); return s; } }