我有一个QString
,其中包含以下格式的日期:
2014-03-18 09:30:36
如何将其格式化为:HH:mm
?
QDateTime::fromString
和 QDateTime::toString
方法:QString dateStr = "2014-03-18 09:30:36";
QString fmt = "yyyy-MM-dd hh:mm:ss";
QDateTime dt = QDateTime::fromString(dateStr, fmt);
QString timeStr = dt.toString("hh:mm");
function todayDate(){
var months = [ "jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec" ];
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth();
var yyyy = today.getFullYear();
if(dd<10){
dd='0'+dd;
}
if(mm<10){
mm='0'+mm;
}
var today = dd+months[mm]+yyyy;
console.log("Date::::::::::::::::"+today)
}