Click here to Skip to main content
15,918,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The date is in millis how can i get to become format like "yyyy-MM-dd HH:mm:ss"

here is my code:
package com.example.u_nation.portablenotebook;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

public class NoteAdapter extends ArrayAdapter<Note> {

    public class ViewHolder{
        TextView dateCreatedMilli;
        TextView title;
        TextView note;
        ImageView noteIcon;
    public NoteAdapter(Context context, ArrayList<Note> notes) {
        super(context, 0, notes);

    public View getView(int position, View convertView, ViewGroup parent){

        Note note = getItem(position);

        ViewHolder viewHolder;

        if (convertView == null) {

            viewHolder = new ViewHolder();

            convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_row, parent, false);

            viewHolder.dateCreatedMilli = (TextView) convertView.findViewById(;

            viewHolder.title = (TextView) convertView.findViewById(;
            viewHolder.note = (TextView) convertView.findViewById(;
            viewHolder.noteIcon = (ImageView) convertView.findViewById(;

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        viewHolder.dateCreatedMilli.setText(note.getDate() + "");

        return convertView;



What I have tried:

im still finding out how to get it right if you know how to help me.. please response! thanks a lot!
Updated 27-Sep-16 22:11pm
[no name] 27-Sep-16 13:57pm    
Try something like DateFormat.getInstance().format(currentTimeMillis);
Member 12745794 27-Sep-16 14:02pm    
thanks for response! @NotPolitcallyCorrect but can you please elaborate it so i can understand how to create it? thnks!

1 solution

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900