
May 3rd, 2003, 06:51 AM
|
|
Junior Member
|
|
Join Date: Apr 2003
Posts: 15
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
date and time function in C
hi!
well i want to store date and time in my myql database...
time(&now);
nowbase = localtime(&now);
if (nowbase)
{
hrtrans = nowbase->tm_hour;
printf("Seconds for hours: %d\n", hrtrans);
mintrans = nowbase->tm_min ;
printf("Seconds for minutes: %d\n", mintrans);
printf("SECONDS: %d\n", hrtrans + mintrans + nowbase->tm_sec);
day = nowbase->tm_mday;
printf("day of month: %d\n", day);
month = nowbase->tm_mon; // Jan==0
printf(" month of year: %d\n", month);
year = nowbase->tm_year+1900;
printf("year: %d\n",year);
using this code i can get the values of..hour..minute,,day,,month and year..that is fine...but i also want to store the date in complete format..like 03.05.2003
similarly time...10:30
i cant fdigure out how can i store this in the required format in database...
plz guide me
waiting
|