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);
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en