i know that the datetime.utcnow command is to show the date and time of the instant it was called.

just say i have this

int time;
time = //27/08/2009 09:00:00

time = time + //15 seconds

what is the code or the numbers i need to use for this?

Use the TimeSpan class and the overloaded + operator.

TimeSpan FifteenSecs = new TimeSpan(0, 0, 15);
time = time + FifteenSecs;
Comments
thats how you do it :)

In addition to the timespan you can also add dates using the DateTime class:

DateTime utcNow = DateTime.UtcNow.AddSeconds(15);

cheers thats helped, i have a part of a string that has the date in it, i can extract it but how do i use that as the start time.

like how would 27/08/2009 09:00:00 actually be put into "time" so that it timespan actually adds 15 seconds on to it

In your first code sample you used an int as type for your time variable, that is not correct.
Use this (just as Scott suggested already) DateTime time = DateTime.UtcNow;
Now you can say things like time.AddSeconds(15); or use a TimeSpan like I did.

i have this in a string:

"DATA COLLECTED FOR 24 HOURS STARTING AT: 09:00:00 Hrs 27-08-09"

how would i go about making it "27-08-09 09:00:00"

i have a rough idea with splits and trims etc but i dont actually know how i would get both beside each other. perhaps putting each word in a string, finding out which ones it is then printing out a string made up of the elements containing them?

yeah it is, each file comes in with same string, but different time and date.

If you know your string is ALWAYS of the same format you could use:

string input = "DATA COLLECTED FOR 24 HOURS STARTING AT: 09:00:00 Hrs 27-08-09";
            string dateStr = input.Substring(input.Length - 8, 8);
            string timeStr = input.Substring(input.Length - 21, 8);
            string datetimeStr = dateStr + " " + timeStr;

cheers i did something similar, i have a parts of my code triming and spliting the code up so i just copied on of those, pointed it at the right string and populated a new array with the values, then found which elements had the values i wanted then made

time = (array[9] + " " + array[7];

cheers and thanks for all your help

This question has already been answered. Start a new discussion instead.