Quantcast
Channel: How to get current timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss" - Stack Overflow
Viewing all articles
Browse latest Browse all 12

Answer by user3144836 for How to get current timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss"

$
0
0

A more appropriate approach is to specify a Locale region as a parameter in the constructor. The example below uses a US Locale region. Date formatting is locale-sensitive and uses the Locale to tailor information relative to the customs and conventions of the user's region Locale (Java Platform SE 7)

String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss", Locale.US).format(new Date());

Viewing all articles
Browse latest Browse all 12

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>