Manipulating tm_mon in struct tm?

后端 未结 1 1335

I\'m having trouble understanding this program, namely the tm_mon +1 part.

I am new to C and I normally always write my own little programs for any challeng

相关标签:
1条回答
  • 2021-01-28 06:12

    Take a look at the following table. As you can see tm_mon is a value from 0=january to 11=december.

    enter image description here

    '*' tm_sec is generally 0-59. The extra range is to accommodate for leap seconds in certain systems.

    EDIT

    Then in your case without +1 in case of date 1/1/2015 the real output will be

    The date in 4,000,000 seconds will be 0/1/2015
    

    With +1 will propel output

    The date in 4,000,000 seconds will be 1/1/2015
    
    0 讨论(0)
提交回复
热议问题