cancel
Showing results for 
Search instead for 
Did you mean: 

System.currentTimeMillis() and Date()

Former Member
0 Kudos

Hi,everybody

What is the difference beetween System.currentTimeMillis() and Date()?

Regards,

Michael

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Michael,

System.currentTimeMillis() -- current date represented as number of milliseconds after/before Jan 1, 1970

java.util.Date -- object that encapsulates date, when constructor called without arguments then it's current date. Note that almost all methods of this class are deprecated while it was designed only for Grigorian calendar. To get specific day/month/year from java.util.Date use java.util.Calendar.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi,Valery

Thanks for your reply.I have 1 more question.

Why if I do the following:

Date currentDate = new java.sql.Date( System.currentTimeMillis());

or

Date currentDate = new Date();

and after

int curMonth = currentDate.getMonth();

I recieve curMonth = 3 (but it is an april now)

But when I do the following:

wdContext.currentContextElement().setMonth(curDate);

I see on the screen the right current date(Month of type string in the context),

i.e. month is april.

???

Regards,

Michael

luciano_leitedasilva
Contributor
0 Kudos

Michel,

At Java API, A month is represented by an integer from 0 to 11; 0 is January,

1 is February, and so forth; thus 11 is December.

When this date is displayed at your web dynpro interface, this date is showed normaly.

Regards,

Luciano