Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert A given date into long

 
kayanaat sidiqui
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a formatted date as given below--



Is there any way to convert this string into long value?

I tried to use


But it's throwing
format.parseObject(String) failed
exception.
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Try this.



Regards
Antany.
 
kayanaat sidiqui
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Antany. It's working fine.
Thanks a lot.

Wel i have one more query.

I am using the following code for getting last modified date.



But the problem is this it's not giving 24 hrs format.

How to get that?

Thanks,
Kaya.
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kya,



Regards
Antany
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the API documentation of class SimpleDateFormat, it explains exactly how the format string works.
 
kayanaat sidiqui
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Antany.

It was really helpful.

Thank you once again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic