Why am i getting same values of different JSON date values?

Posted by Maxood on Stack Overflow See other posts from Stack Overflow or by Maxood
Published on 2010-04-16T12:16:00Z Indexed on 2010/04/17 0:03 UTC
Read the original article Hit count: 273

Filed under:

I do not know the reason why am i getting same values of different JSON date values. Here is my code for parsing date values in JSON date format:

package com.jsondate.parsing;

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

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class JSONDateParsing extends Activity {
    /** Called when the activity is first created. */
    String myString;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);


        TextView tv = new TextView(this);
        //Date d = (new Date(1266029455L));
        //Date d = (new Date(1266312467L));
        Date d = (new Date(1266036226L));


        //String s = d.getDate() + "-" + d.getMonth() + "-" + d.getYear() + d.getHours() + d.getMinutes() + d.getSeconds();
       // SimpleDateFormat sdf=new SimpleDateFormat("yyyy MMM dd @ hh:mm aa");
        //Toast.makeText(this, d.toString(), Toast.LENGTH_SHORT);
        Log.e("Value:", d.toString());
        myString = d.toString();
        String []words = myString.split(" ");

        for(int i = 0;i < words.length; i++)
            Log.e("Value:", words[i]);

        myString = words[2] + "-" + words[1] + "-" + words[5] + " " + words[3];

        tv.setText(myString);
        setContentView(tv);


    }
}

© Stack Overflow or respective owner

Related posts about JSON