Thread: Compare Date and show the difference

  1. #1
    Registered User
    Join Date
    May 2012

    Compare Date and show the difference

    I have a file, 'date-list.txt' which has date in it. For example , 20 May 2012 .Now I want to compare this date with current system date and show the difference in days .How can i compare dates and shows difference in days in C++.?Im really a c++ beginner . So , if possible , please show and guide me with codes . Thanks in advanced .

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    After you read in all the dates, make them into time_t's with mktime(). Then call difftime() and divide the result into units of days. Use the examples to get the idea, and post if you need more help after trying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-07-2012, 07:37 AM
  2. Show Date
    By kaushal1111 in forum C Programming
    Replies: 3
    Last Post: 01-13-2012, 01:01 AM
  3. Review required for program of date difference
    By chottachatri in forum C Programming
    Replies: 6
    Last Post: 10-31-2008, 11:46 AM
  4. Show current date without using system timer
    By stormrider in forum C Programming
    Replies: 21
    Last Post: 10-01-2006, 07:58 PM
  5. Show log entries in a date range
    By JizJizJiz in forum C++ Programming
    Replies: 4
    Last Post: 06-08-2005, 05:33 PM

Tags for this Thread