Link to home
Start Free TrialLog in
Avatar of william007
william007

asked on

How to convert datetime to long value?

I wish to use the timestamp class, as the first method is deprecated, I wish to use the second one. What is the common way to convert the year, month, date, hour, minute, second, and nano to a long value?

Timestamp(int year, int month, int date, int hour, int minute, int second, int nano)
          Deprecated. instead use the constructor Timestamp(long millis)
Timestamp(long time)
          Constructs a Timestamp object using a milliseconds time value.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of william007
william007

ASKER

Hi, may I know how to set the Calendar with the date information? as I can't see a direct way to do this from the calendar API.
Hi, I just miss it, the calendar class has a method
set(int year, int month, int date, int hourOfDay, int minute, int second)

Thanks:-)
:-)