Current timestamp as filename in Java

前端 未结 7 1546

I want to name new files created by my Java application with the current timestamp.

I need help with this. How do I name the new files created with the current timestamp

相关标签:
7条回答
  • 2021-02-03 18:10

    You can get the current timestamp appended with a file extension in the following way:

    String fileName = new Date().getTime() + ".txt";
    
    0 讨论(0)
提交回复
热议问题