Java Programming: Date and Time Class

  • nek / 206 / Fri, 19 Mar 2010 03:36:00 GMT / Comments (2)
  • I want to add Date and Time to my Java Program , How can i get the system time and date and pass to Java program ?

    Many Many Thanks

    ~ Samba, more than a low cost File and Printer server ~

    -- Let us OpenSource --
  • Keywords:

    date, time, class, java, programming

  • http://java.itags.org/java-programming/332358/«« Last Thread - Next Thread »»
    1. Nek wrote:
      > I want to add Date and Time to my Java Program , How can i get the
      > system time and date and pass to Java program ?

      import java.text.SimpleDateFormat;
      import java.util.Date;
      ...
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      System.out.println(sdf.format(new Date()));

      *Or* when you are only interested in the system date and time in ms:

      long sysTimeMs = System.currentTimeMillis();

      JW

      janwillemborleffs | Wed, 26 Dec 2007 22:49:00 GMT |

    2. Hi JW ,

      Many thanks !!

      Ken :-)

      "Janwillem Borleffs" <jw...jwscripts.com> glsD:4285d5b0$0$6770$dbd41001...news.euron et.nl...
      > Nek wrote:
      >> I want to add Date and Time to my Java Program , How can i get the
      >> system time and date and pass to Java program ?
      >>
      > import java.text.SimpleDateFormat;
      > import java.util.Date;
      > ...
      > SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      > System.out.println(sdf.format(new Date()));
      > *Or* when you are only interested in the system date and time in ms:
      > long sysTimeMs = System.currentTimeMillis();
      >
      > JW

      ~ ?榳?^, R*n?*I ~

      ~ Samba, more than a low cost File and Printer server ~

      -- Let us OpenSource --

      nek | Wed, 26 Dec 2007 22:50:00 GMT |

  • Java Programming Questions

    • Errors I can't resolve!

      I can't seem to resolve these errors. I have had people compile these codes on their computers with ...

      By momov4, 4 Comments

    • Z-order value for JDialog

      Dear all, I have a JFrame in which I have add a toolbar inside a JPanel which is kept at t...

      By rajiparthiban, 4 Comments

    • Zoom in an image

      Are there anything in the API that allow me to perform zoom in and zoom out function to a bufferedIm...

      By hen163, 1 Comments

    • zip not including empty directories in zip file

      Hai Vinod(Maven1.0.2)Can you refer following urland use thisEX: <zip destfile="${dist}/manual.zip...

      By natarajansasikumar, 1 Comments

    • Webstart plugin

      A question about this plugin :- Is there somewhere a "template.vm" example file I can take as abasis...

      By sebastiencesbron, 2 Comments