Click here to Skip to main content
15,949,686 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:
Java
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);

    }
    @Override
    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(R.id.listDate);

            viewHolder.title = (TextView) convertView.findViewById(R.id.listItemNoteTitle);
            viewHolder.note = (TextView) convertView.findViewById(R.id.listItemNoteBody);
            viewHolder.noteIcon = (ImageView) convertView.findViewById(R.id.listItemNoteImg);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.dateCreatedMilli.setText(note.getDate() + "");
        viewHolder.title.setText(note.getTitle());
        viewHolder.note.setText(note.getMessage());
        viewHolder.noteIcon.setImageResource(note.getAssociatedDrawable());

        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!
Posted
Updated 27-Sep-16 22:11pm
v3
Comments
[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