Thread: C Routine for a Date

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    1

    C Routine for a Date

    Does anyone have a C routine that allows the user
    to pass a date, 'YYYYMMDD' and the # of days
    to add to the date and return the new date.

    I need it to calculate dates in the future.

    Thanks

    Kevin

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    26
    There is no C routine to do this, but you could /easily/ write your own....

  3. #3
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    I agree with Agrajag. But if you need to get started on this then you should probably start by looking into what functions like time(), gmtime() and other "time" functions do. And also on how to work with the time_t structure. (they should all be in the time.h header file of your compiler. this stuff is pretty standard).
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

  4. #4
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    Ooops, my bad!

    The structure name is not "time_t", it's "tm".
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 08:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM
  4. CDate Class - handle date manipulation simply
    By LuckY in forum C++ Programming
    Replies: 5
    Last Post: 07-16-2003, 08:35 AM