Is there any API for Data?
-
Hi, Is there any win32 API available for date calculation? All i need is, once the system date time is read (for EX: Mon, 10 Nov 2008 11:11:20) from this we need to add 72 hours, and the time after 72 hours should be Thu, 13-Nov-2008 12:11:20. I am able to get the current time from system. But i like to know how to calculate date and time after 72 hours. Is there any API available for this? Mon, 10 Nov 2008 11:11:20 - This I am able to get from system. Thu, 13-Nov-2008 12:11:20 - I need to calculate for this date and time (that I should after 72 hours) Can anyone help me in this regards. -Nanadu
-
Hi, Is there any win32 API available for date calculation? All i need is, once the system date time is read (for EX: Mon, 10 Nov 2008 11:11:20) from this we need to add 72 hours, and the time after 72 hours should be Thu, 13-Nov-2008 12:11:20. I am able to get the current time from system. But i like to know how to calculate date and time after 72 hours. Is there any API available for this? Mon, 10 Nov 2008 11:11:20 - This I am able to get from system. Thu, 13-Nov-2008 12:11:20 - I need to calculate for this date and time (that I should after 72 hours) Can anyone help me in this regards. -Nanadu
The solution is as follows.
int main() { // Current date/time based on current system time_t now = time(0); int number_minutes=72*60; // 72 HOURS tm* localtm = localtime(&now); cout << "The local date and time is: " << asctime(localtm) << endl; now += (60 * number_minutes); //60secs * minutes struct tm* localtm_edited = localtime(&now); tm* localtm_edited = localtime(&now); cout <<"The local date and time i is: " << asctime(localtm_edited); // << endl; } return 0; }
-
Hi, Is there any win32 API available for date calculation? All i need is, once the system date time is read (for EX: Mon, 10 Nov 2008 11:11:20) from this we need to add 72 hours, and the time after 72 hours should be Thu, 13-Nov-2008 12:11:20. I am able to get the current time from system. But i like to know how to calculate date and time after 72 hours. Is there any API available for this? Mon, 10 Nov 2008 11:11:20 - This I am able to get from system. Thu, 13-Nov-2008 12:11:20 - I need to calculate for this date and time (that I should after 72 hours) Can anyone help me in this regards. -Nanadu
Just out of curiosity, why do you repeat same question 3 times :-) -Saurabh
-
The solution is as follows.
int main() { // Current date/time based on current system time_t now = time(0); int number_minutes=72*60; // 72 HOURS tm* localtm = localtime(&now); cout << "The local date and time is: " << asctime(localtm) << endl; now += (60 * number_minutes); //60secs * minutes struct tm* localtm_edited = localtime(&now); tm* localtm_edited = localtime(&now); cout <<"The local date and time i is: " << asctime(localtm_edited); // << endl; } return 0; }
the "localtm_edited" redefinition..:confused:
-
the "localtm_edited" redefinition..:confused:
is there some error you get? Please check you have not define localtm_edited variable twice in your code.
Some things seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
The solution is as follows.
int main() { // Current date/time based on current system time_t now = time(0); int number_minutes=72*60; // 72 HOURS tm* localtm = localtime(&now); cout << "The local date and time is: " << asctime(localtm) << endl; now += (60 * number_minutes); //60secs * minutes struct tm* localtm_edited = localtime(&now); tm* localtm_edited = localtime(&now); cout <<"The local date and time i is: " << asctime(localtm_edited); // << endl; } return 0; }
Thanks, its working fine. Similarly is there any way to give the time as input and get the out put calculated for next 72 hours. For Example in-put will in the format "Thu, 13 Nov 2008 12:11:20 GMT" and i need the out-put as "Mon, 10 Nov 2008 11:11:20 GMT", this is calculated for next 72. Is it possible to give in-time and get calculated for next 72 hours? -Nandu