In article
<64fb5935-6728-46ed-ad64-(E-Mail Removed)>,
(E-Mail Removed) wrote:
> I would like to show year as 9999 instead 1999, I am using mktime and
> ctime, it always shows only 1900 range, can't able to change year only
> to 9999, How can I change year to 9999 instead1999?. Thanks in
> advance.
If you're on a system where time_t is 32 bits, the highest date it can
represent is in the year 2038.
If you have a 64-bit time_t, you should be able to put 8099 in the
tm_year member to get the year 9999.
>
>
>
> > #include <time.h>
> > #include <stdio.h>
> > int main(void)
> > {
> > struct tm t = { 0, /* seconds */
> > 30, /* minutes */
> > 8, /* hours since midnight */
> > 1, /* day of month */
> > 6, /* months since January */
> > 99, /* years since 1900 */
> > 0, /* day of week (reset by mktime) */
> > 0, /* day of year (reset by mktime) */
> > 0}; /* daylight/standard switch */
> > time_t c;
> > c = mktime(&t);
> > printf("%s\n", ctime(&c));
> > return 0;
> > }
--
Barry Margolin,
(E-Mail Removed)
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***