Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nerak

[java] getTimeInMillis

This topic is 5491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Has anybody implemented de function getTimeInMillis? I have de standar 1.3.1 JDK, working with OC4J. The message I get is the following: No method matching getTimeInMillis() found in class java.util.Calendar. diffMillis = fecha2.getTimeInMillis(); My code is: <%@ page import="java.io.*" %> <%@ page import="java.net.*" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.*"%> <%@ page import="java.text.*" %> <%@ page import="java.lang.*" %> <%@ page import="java.text.DateFormat" %> <% Calendar fecha2 = Calendar.getInstance(); fecha2.set(Calendar.DAY_OF_MONTH, 12); fecha2.set(Calendar.MONTH, 10); fecha2.set(Calendar.YEAR, 2000); long diffMillis=0; diffMillis = fecha2.getTimeInMillis(); %>

Share this post


Link to post
Share on other sites
Advertisement
Since calendar.getTimeInMillis() is protected you can''t call it from outside the object or one of its subclasses.

I think you could call fecha2.getTime().getTime()

The first getTime() returns a java.util.Date from the Calendar object, and the second getTime() returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. This is all if you''re trying to get the milliseconds for some arbitrary calendar date. If you just want the current system time then listen to tortoise.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!