Java Code Examples for java.util.Date#toLocaleString()

The following examples show how to use java.util.Date#toLocaleString() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: MapsMeasure   File:    License: Apache License 2.0 5 votes vote down vote up
public View getView(int position, View convertView, final ViewGroup parent) {
	ViewHolder holder;
	if (convertView == null) {
		convertView = mInflater.inflate(R.layout.deletelistitem, null);
		holder = new ViewHolder();
		holder.iv = convertView.findViewById(; = (TextView) convertView.findViewById(;
	} else {
		holder = (ViewHolder) convertView.getTag();
	String filename = files.get(position).getName();
	if (filename.startsWith("MapsMeasure_")) {
		try {
			Date date = new Date(Long.parseLong(filename.substring(filename.lastIndexOf("_") + 1, filename.lastIndexOf("."))));
			filename = date.toLocaleString();
		} catch (NumberFormatException nfe) {
	} else {
		filename = filename.substring(0, filename.lastIndexOf("."));
	return convertView;
Example 2
private String formatTimestamp(long timestamp) {
	// Temporary - improve by showing how long ago the build happened
	Date date = new Date(timestamp);
	return date.toLocaleString();
Example 3
Source Project: lunzi   File:    License: Apache License 2.0 4 votes vote down vote up
public static String getDateTimeFileTitle(Date dt) {
	String fileName = dt.toLocaleString();//
	return toValidFileName(fileName);//