Time format / conversion problem


#1

Hello,

I'am little bit confused about my time conversion results ...

 

  Time ti(2014,7,4,19,30);
  String s = ti.formatted("%Y-%m-%d %H:%M:%S");

returns  "2014-08-04 19:30:00"  for 's'.

Why the month value is changed ???

regards

 elli


#2

The range is 0 - 11 for months in the "tm" struct, and Time's constructor states the same. Time::formatted() confusingly outputs a month within the range [1-12], as stated by function.

See http://www.cplusplus.com/reference/ctime/tm/

Edit: Corrections.


#3

some hours for nothing ...

RTFM

elli