View Single Post
  #9 (permalink)  
Old March 6th, 2016, 03:16 PM
StefanieD StefanieD is offline
Registered User
Points: 22, Level: 1
Points: 22, Level: 1 Points: 22, Level: 1 Points: 22, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2016
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date issue resolved

Actually, after I thought about it a little more, I went back and looked a little closer and found a typo in the date format. After I fixed that and ran the debugger again, I could see the dates listed each time the program went through the loop, but they still weren't showing on the device. So I thought, maybe they aren't showing up because I wasn't asking them to. I took a look at my and, sure enough, I had entered the book code and all it asks for is the time.

In the book only lists:

sdf = new SimpleDateFormat("hh:mm");

So you only get the hour and minute values. I changed the code to:

Public String toString() {

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd, hh:mm");

String dateString = sdf.format(date);

return dateString + ": " + "M " + magnitude + ", " + details;


Now I have the date as well as the time in my listing.

I still can't get the program to give me the listing in Eclipse.
Reply With Quote