<p>How can I transform a time value into YYYY-MM-DD format in Java?</p>

<pre><code>long lastmodified = file.lastModified();
String lasmod =  /*TODO: Transform it to this format YYYY-MM-DD*/
</code></pre>

Something like:
```
```
Date lm = new Date(lastmodified);
String lasmod = new SimpleDateFormat("yyyy-MM-dd").format(lm);
```
```
See the javadoc for
SimpleDateFormat
.