Preferably as a long.
All the example I can find are getting the date/time as a string and not any scalar value. 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you really want the current time as a long, try
System.currentTimeMillis(). Alternatively, you can usenew Date().getTime().However, using the current time as a random number generator seed is a very poor choice (at least, if you are using the random numbers for anything important, such as cryptography). You may wish to consider using a random source such as
/dev/urandom(if available on your platform).