I'm working with d3.js and I'm using this documentation .
I use this to show the hour: %I:%M
which shows the hour like 02:34
.
Is there a way to remove the leading zero, in this case showing the data as 2:34
?
As outlined in the documentation , the default padding is zero-padding for all directives except %e
(for which it is space-padding).
To change the padding type, you can append a modifier to %
:
0
- zero-padding _
- space-padding -
- disable padding So, given your example: %-I:%M
.
%-I
会去掉前导零。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.