Problem on Adding Time on... Time!

 

Hi,

what I m trying to do is on a string that i m reading from a file that has a Date format to add 24 hours. So for example

I m reading '2012.01.16 14:00' to convert this on '2012.01.17 14:00' and so on. Its a CSV file from an excel so Date format is not a problem i can change it.

But I ve got problems like:

- I cant figure out hot to add time to "time".. is it done like mydayis=StrToTime(D '2012.01.16 14:00' )+ what? How you add time so to get on on the next day?

- Even bigger problem is when i m at the end of a month like '2012.01.31 14:00' and then i should convert to '2012.02.01 14:00' etc

Any code function/help on that?

Thanks

Athan

 
athanfx:
- I cant figure out hot to add time to "time".. is it done like mydayis=StrToTime(D '2012.01.16 14:00' )+ what? How you add time so to get on on the next day?
There are 24 hours each and every day.
datetime mydayis          = StrToTime(D '2012.01.16 14:00' ),
         tomorrow1400     = mydayis + 86400,      // 24 * 60 * 60
         midnight         = mydayis - mydayis % 86400,
         tomorrow0000     = midnight + 86400,
         tomorrow1400also = tomorrow0000 + 50400; // 14 * 60 * 60
 
athanfx:


- I cant figure out hot to add time to "time".. is it done like mydayis=StrToTime(D '2012.01.16 14:00' )+ what? How you add time so to get on on the next day?

You need to read about and understand datetime variable types . . . especially here where it says . . .

"Its internal representation is a long integer number of 4 bytes. The value represents the amount of seconds elapse from 00:00 Jan 1, 1970. "

Reason: