Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How to use the currentTimeMillis() method in java

Options
  • 17-12-2004 3:45pm
    #1
    Moderators, Society & Culture Moderators, Sports Moderators Posts: 12,272 Mod ✭✭✭✭


    could someone post up a bit of code illustrating how exactly to use this method or alternatively if there is a mthod in java that just returnd the time in hours and minutes could you post that up instead. Thanking you

    Patrick


Comments

  • Registered Users Posts: 597 ✭✭✭bambam


    Date today;
    String dateOut;
    DateFormat dateFormatter;
    dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT);
    today = new Date();
    dateOut = dateFormatter.format(today);
    System.out.println("Date : " + dateOut + " " );


    // calling new Date() gives you a date as of 'now'.


  • Moderators, Society & Culture Moderators, Sports Moderators Posts: 12,272 Mod ✭✭✭✭Kingp35


    nice one worked perfectly


Advertisement