Ruby strftime: Month without leading zero?

前端 未结 4 975
忘了有多久
忘了有多久 2021-01-30 15:57

Does Ruby\'s strftime have a format for the month without a leading zero?

I found %e for getting the day without the leading zero, but not hav

4条回答
  •  长发绾君心
    2021-01-30 15:59

    Docs show a number of different options for configuring number format. Adding to the %-d format, you can also use these flags in place of "-":

    Flags:
      -  don't pad a numerical output.
      _  use spaces for padding.
      0  use zeros for padding.
      ^  upcase the result string.
      #  change case.
      :  use colons for %z.
    

提交回复
热议问题