Two Laptop Bag
The moose likes Beginning Java and the fly likes BigDecimal to Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "BigDecimal to Date" Watch "BigDecimal to Date" New topic

BigDecimal to Date

Tanu Gulati
Ranch Hand

Joined: Oct 06, 2008
Posts: 113

Can any body tell me how to convert BigDecimal to Date?

Tanu Gulati
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14993

A BigDecimal holds a number. A Date is something completely different. Does your BigDecimal hold a number that somehow encodes a date? You need to know what the number in the BigDecimal means exactly to be able to convert it.

Assuming that your BigDecimal holds the number of milliseconds since 1 January 1970, 12:00 AM UTC (which is a common way to encode dates), you could do it like this:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: BigDecimal to Date
It's not a secret anymore!