sammy sammy - 1 year ago 119
Javascript Question

how to remove zero if hours less then 10 from d3.time.format("%I %p")

I am very new to d3.js. I am using

d3.time.format("%I %p")
which returns hours with a zero appended with single digit.

For example
new Date(1985,11,1,5,39,13)
. How to make it return a single digit if hour is less than

Answer Source

Simply write a minus sign before I:

d3.time.format("%-I %p");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download