0

In this question I have two doubts. Firstly I have two string variables named biddate and placeddate respectively which contains date and time in string format.The value in biddate is in this format: 17-Feb-14 12:54:00 PM and the value in placeddate is also in this format: 15-Feb-14 9:55:38 PM. I need to convert both the strings biddate and placeddate to the date and time format as given. But I don't know how to do this.

Secondly I need to create a timer in my activity using these two values biddate and placeddate. As it can be seen that biddate value is always higher than product date value, so I need a timer which counts down from biddate to placeddate each second by second. So the difference between biddate and placeddate should be displayed as: xx days xx hours xx minutes remaining, when I start my activity. When the biddate and placeddate difference becomes less than 1 day, the timer should display as xx hours xx minutes remaining. When the biddate becomes equal to placeddate, it should display as some message in my activity as bidding ended or somewhat message like that.

I'm a newbie in this android world. So I don't know how to do the above two things. Can any one please help me out by helping me with the program code for the above two things.

njnjnj
  • 978
  • 4
  • 23
  • 58
  • You can use `Joda`(http://www.joda.org/joda-time/) for this purpose. The joda documentation should help you to achieve your objective. No one on this site is going to write code for you :). If you have tried something, post your code here, and people will be happy to correct/help you. – rgamber Feb 16 '14 at 04:55
  • Dude, If I know the answer for my question, then why the hell should I post it here... I mean to say that I'm a new comer to android, and I don't know the functions or anything to do the above scenario. So please understand my situation... – njnjnj Feb 16 '14 at 05:01

1 Answers1

-1

"The value in biddate is in this format: 17-Feb-14 12:54:00 PM and the value in placeddate is also in this format: 15-Feb-14 9:55:38 PM. I need to convert both the strings biddate and placeddate to the date and time format as given"

and what is that format? If you want to format date strings, you should read the documentation for SimpleDateFormat. It is pretty straightforward to format a date string into any format you like. From SimpleDateFormat you can parse your dates into Calendar objects, compare them, then use a Thread or Timer to do the rest.

David C Adams
  • 1,953
  • 12
  • 12