How to get the current system Date and Time in Java?

In order to get the current system Date and Time include the below code in you java class –

import oracle.jbo.domain.Date;

  /**
      * Get Current Date
      * @return
      */
public Date getCurrentDateTime()
    {
    return new Date(new java.sql.Timestamp(System.currentTimeMillis()));
    }

The getCurrentDateTime() method returns the system Date and Time in the format  “2011-08-08 17:02:24.0”.

Advertisements
This entry was posted in Java and tagged , , , , . Bookmark the permalink.

4 Responses to How to get the current system Date and Time in Java?

  1. Archa says:

    an error “package oracle.jbo.domain does not exist” reported

  2. Great blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple tweeks would really make my
    blog stand out. Please let me know where you got your theme.
    With thanks

  3. Tomoko says:

    I’m now not certain where you’re getting your info,
    but good topic. I needs to spend some time studying much more or
    working out more. Thanks for great info I was on the lookout
    for this information for my mission.

  4. Carole says:

    I used to be suggested this blog by my cousin. I am no longer positive whether this publish is written by way of
    him as nobody else realize such precise about my trouble.

    You’re wonderful! Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s