Compare Date and show the difference

This is a discussion on Compare Date and show the difference within the C++ Programming forums, part of the General Programming Boards category; I have a file, 'date-list.txt' which has date in it. For example , 20 May 2012 . Now I want ...

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    2

    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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,638
    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, 12: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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21