Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Time stamp

  1. #1
    Member
    Join Date
    Jun 2011
    Posts
    68
    My Mood
    Cool
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Time stamp

    How can i generate a timestamp which is simple and can be attached to a message as integer insteead of a string.. any neat ideas Gurus

    thanks


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Time stamp

    How are you attaching it to a message as a String in the first place?

    Sounds like a job for System.currentTimeMillis().
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: Time stamp

    Let me get my spoon ... open wide .... a search for what you're asking for:
    java time stamp - Google Search
    Gives you a lot of pages (all but one when I do it) of stuff you probably don't want because there happens to be a class in the java.sql package whose name matches, so I reckon 'spoon-feeding' is ok in this instance. What you're looking for is System.currentTimeMillis() or System.nanoTime(). Read the API documentation about the two methods: they're ok for timestamps but not for unique identifiers nor for accurate measurements.

    System (Java Platform SE 6)

Similar Threads

  1. Help with run time error
    By white97 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: August 11th, 2011, 12:35 PM
  2. Run Time Error.
    By seymour001 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 10th, 2011, 12:10 PM
  3. First Time
    By rayoung17 in forum Member Introductions
    Replies: 1
    Last Post: April 4th, 2011, 01:52 PM
  4. [SOLVED] Run time error
    By moodycrab3 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 7th, 2011, 11:05 AM
  5. Using time
    By ellias2007 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 4th, 2010, 08:48 AM