如何在 Java 中获取字符串格式的时间戳?"yyyy.MM.dd.HH.mm.ss"
How to get timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss"
String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Timestamp());
这是我的,但是 Timestamp() 需要一个参数...
This is what I have, but Timestamp() requires an parameters...
替换
new Timestamp();
与
new java.util.Date()
因为 Timestamp 没有默认构造函数,也可以使用方法:
because there is no default constructor for Timestamp, or you can do it with the method:
new Timestamp(System.currentTimeMillis());
这篇关于如何在Java中以字符串格式获取当前时间戳?“yyyy.MM.dd.HH.mm.ss"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
“Char 不能被取消引用"错误quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用错误)
Java Switch 语句 - 是“或"/“和"可能的?Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 语句 - 是“或/“和可能的?)
Java替换字符串特定位置的字符?Java Replace Character At Specific Position Of String?(Java替换字符串特定位置的字符?)
具有 int 和 char 操作数的三元表达式的类型是什么What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作数的三元表达式的类型是什么?)
读取文本文件并存储出现的每个字符Read a text file and store every single character occurrence(读取文本文件并存储出现的每个字符)
为什么我需要在 byte 和 short 上显式转换 char 原语Why do I need to explicitly cast char primitives on byte and short?(为什么我需要在 byte 和 short 上显式转换 char 原语?)