Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    how to get milliseconds in jsp

    hi,
    i need one help for how to get current milliseconds in jsp or java

  • #2
    New Coder
    Join Date
    Jan 2011
    Location
    India
    Posts
    31
    Thanks
    0
    Thanked 4 Times in 4 Posts
    new Date().getTime();

    should give you millisecs elapsed from 1970 jan 1st.

    If you need the present. Then you need to use the calender class

    Calendar c = Calendar.getInstance();
    c.get(Calendar.MILLISECOND)

  • #3
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    current date and time with milliseconds.

    hi..
    i done that way already...
    but my requirement is :
    current date and time with milliseconds.
    EX:
    dd-MM-yyyy hh:mm:ss:SSS
    22-12-2010 02:55:56:784

  • #4
    New Coder
    Join Date
    Jan 2011
    Location
    India
    Posts
    31
    Thanks
    0
    Thanked 4 Times in 4 Posts
    You need to use DateFormatter

    SimpleDateFormat class

    use :-

    DateFormat df = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss:SSS");
    System.out.println(df.format(new Date()));


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •