Connecting Tech Pros Worldwide Help | Site Map

dateTime addition

simon
Guest
 
Posts: n/a
#1: Nov 17 '05
I have :

dateTime dateFinal;
DateTime dateFirst;
string startTime;

startTime="2:02:05";

dateFirst="22.08.2005 0:00:00";(read this value from some control)

How can I get the date from dateTime and string variable?

Something like this:

dateFinal=dateFirst+startTime;

dateFinal should be: "22.08.2005 2:02:05"

regards,S


gmiley
Guest
 
Posts: n/a
#2: Nov 17 '05

re: dateTime addition


you could use the following (though I am sure there must be a better
way):

string startTime = "2:02:05";
DateTime firstDate = DateTime.Today;
DateTime finalDate = DateTime.Parse(firstDate.Date.ToString() + " " +
startTime);

Charlieee
Guest
 
Posts: n/a
#3: Nov 17 '05

re: dateTime addition


Simon try:

String theDate = dateFirst.Day.ToString();
or
String theDate = Convert.ToString(dateFirst.Day);

Charlie
:-)


"simon" <simon.zupan@stud-moderna.si> wrote in message
news:%23L8S3QkqFHA.2996@tk2msftngp13.phx.gbl...[color=blue]
>I have :
>
> dateTime dateFinal;
> DateTime dateFirst;
> string startTime;
>
> startTime="2:02:05";
>
> dateFirst="22.08.2005 0:00:00";(read this value from some control)
>
> How can I get the date from dateTime and string variable?
>
> Something like this:
>
> dateFinal=dateFirst+startTime;
>
> dateFinal should be: "22.08.2005 2:02:05"
>
> regards,S
>[/color]


Closed Thread


Similar C# / C Sharp bytes