<p>What is the best way to generate a current datestamp in Java? </p>

<p>YYYY-MM-DD:hh-mm-ss</p>

```
```
Date d = new Date();
String formatted = new SimpleDateFormat ("yyyy-MM-dd:HH-mm-ss").format (d);
System.out.println (formatted);
```
```