Android Date to String Convert getFriendlyLocalDateTime(Date date)

Here you can find the source of getFriendlyLocalDateTime(Date date)

Description

Return timestamp in human-readable form wrt local timezone

Parameter

Parameter Description
date to be parsed

Return

formatted timestamp

Declaration

public static String getFriendlyLocalDateTime(Date date) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;

import java.util.TimeZone;

public class Main {
    public static final String friendlyDateFormat = "hh:mm a";

    /**/*from   www .j ava2 s.  co m*/
     * Return timestamp in human-readable form wrt local timezone
     *
     * @param date to be parsed
     * @return formatted timestamp
     */
    public static String getFriendlyLocalDateTime(Date date) {

        final SimpleDateFormat sdf = new SimpleDateFormat(
                friendlyDateFormat);
        sdf.setTimeZone(TimeZone.getDefault());
        return sdf.format(date);
    }
}

Related

  1. getStrFromDate(Date date)
  2. dateToString(Date date)
  3. dateToString(String format, String date)
  4. dateToString(String format, Date date)
  5. dateToString(Date time)
  6. dateTimeToString(final Date date)
  7. dateToString(Date date)
  8. datesToString(final Date start, final int duration)
  9. datesToString(final Date start, final int duration)