Is there a way to use the format
function on a date object, specifically an object of class POSIXlt
, POSIXct
, or Date
, with the format %Y, %m, %d
such that leading zeros are stripped from each of those 3 fields?
For example, I would like format(as.Date("1998-09-02"), "%Y, %m, %d")
to return 1998, 9, 2
and not 1998, 09, 02
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…