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
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.
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
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!
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)