Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #14840

Re: King - Chapter 5 date.c

From "BartC" <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: King - Chapter 5 date.c
Date 2011-12-21 22:17 +0000
Organization A noiseless patient Spider
Message-ID <jctm06$oms$1@dont-email.me> (permalink)
References <a77e63e8-c922-4aa0-9fed-2bdde8328d16@18g2000prn.googlegroups.com><slrnjf25ju.2n2l.usenet-nospam@guild.seebs.net><c1ca3dab-9675-4269-bd28-53de956598a9@n7g2000prb.googlegroups.com><vhv2f79klqee7fccd6quhvmvb98jma7mtm@4ax.com> <20111221113516.1f6d8a97@corefixtop.gillibert.homelinux.net>

Show all headers | View raw


"AndréGillibert" <MetaEntropy.removeThis@gmail.com> wrote in message 
news:20111221113516.1f6d8a97@corefixtop.gillibert.homelinux.net...


> So, the book has been written after year 2000.
>
> Anyway, date handling is tough, and requires knowledge of timezones,
> daylight saving time, calendars, leap years and leap seconds and rule
> changes.

It's not necessary to go that far for something that just needs to parse a 
date, which is just three numbers.

It can be kept simple, but restricting it to years 2000 to 2099 is 
inadvisable (most dates of birth, for example, will be from last century).

In the OP's example, replacing 20%.2d (what does the "." do?) by %4d might 
be all that's needed. (And I would also allow 2-digit years, converting to 
the most likely 19xx or 20xx form where it's reasonably unambiguous.)

-- 
bartc

 

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

King - Chapter 5 date.c flebber <flebber.crue@gmail.com> - 2011-12-20 14:50 -0800
  Re: King - Chapter 5 date.c Seebs <usenet-nospam@seebs.net> - 2011-12-20 23:13 +0000
    Re: King - Chapter 5 date.c flebber <flebber.crue@gmail.com> - 2011-12-20 20:43 -0800
      Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-20 22:47 -0800
        Re: King - Chapter 5 date.c Seebs <usenet-nospam@seebs.net> - 2011-12-21 08:00 +0000
          Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-21 00:22 -0800
      Re: King - Chapter 5 date.c Keith Thompson <kst-u@mib.org> - 2011-12-21 03:55 -0800
      Re: King - Chapter 5 date.c James Kuyper <jameskuyper@verizon.net> - 2011-12-21 08:22 -0500
    Re: King - Chapter 5 date.c flebber <flebber.crue@gmail.com> - 2011-12-20 20:50 -0800
      Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-20 22:45 -0800
        Re: King - Chapter 5 date.c André Gillibert <MetaEntropy.removeThis@gmail.com> - 2011-12-21 11:35 +0100
          Re: King - Chapter 5 date.c Geoff <geoff@invalid.invalid> - 2011-12-21 03:57 -0800
          Re: King - Chapter 5 date.c Seebs <usenet-nospam@seebs.net> - 2011-12-21 19:12 +0000
          Re: King - Chapter 5 date.c "BartC" <bc@freeuk.com> - 2011-12-21 22:17 +0000
            Re: King - Chapter 5 date.c James Kuyper <jameskuyper@verizon.net> - 2011-12-21 18:07 -0500
        Re: King - Chapter 5 date.c superpollo <superpollo@tznvy.pbz> - 2011-12-21 14:44 +0100

csiph-web