Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert date to secs

Status
Not open for further replies.

vi108

Technical User
Jun 25, 2001
1
US
Hello All,

If a user inputs a date(mm/dd/yy) in a program, how do you convert the date to
seconds from 1/1/70 to the current time using the functions in <time.h>?

Thanks for your help.
 

#include <time.h>
#include <stdio.h>

int main()
{
time_t ntime;
time(&ntime);

printf(&quot;sec since 1/1/70: %u&quot;, ntime);

return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top