The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search attributes in one structure using the values from another structure dhanamurthy High Level Programming 3 03-27-2008 12:37 AM
conversion of unix time format sari Windows & DOS: Issues & Discussions 2 03-02-2008 11:33 PM
conversion from EPOCH timestamp to local time zone abhijeetkul Shell Programming and Scripting 2 02-17-2006 03:19 AM
Copying a Directory Structure to a new structure jhansrod UNIX for Dummies Questions & Answers 8 07-27-2005 03:24 AM
Time conversion in Unix kamlakar UNIX for Advanced & Expert Users 1 04-22-2002 09:55 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-05-2008
Registered User
 

Join Date: Jan 2008
Posts: 12
Conversion of time structure in C++

Hi frnds,

I have written a code to get current time

struct tm *locTime;
time_t currentTime;
time( &currentTime );
locTime = localtime(&currentTime );

Suppose now i get output time as 31-DEC-2007 00:00:00

What i want now is i want two strings where in one string i want to subtract time to 2 hours that is one string should have value as 30-DEC-2007 22:00:00 and other string should have value 26 hours less that is 23-DEC-2007 22:00:00

I tried some cases where in i subtracted value but it was not working.Is there a way out for this
Reply With Quote
Forum Sponsor
  #2  
Old 01-05-2008
Registered User
 

Join Date: Sep 2005
Location: india
Posts: 78
subtract/add to the current time.
i.e 2 before current time is preTime = currTime - 2*60*60;
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0