473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

dateTime addition

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
Nov 17 '05 #1
2 2098
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);

Nov 17 '05 #2
Simon try:

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

Charlie
:-)
"simon" <si*********@stud-moderna.si> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michele Simionato | last post by:
Strangely enough, I never needed the datetime and calendar module before, so I just looked at them today. I am surprised I don't easily find an interval function such this: import datetime ...
5
by: Robert Brewer | last post by:
Anyone else tired of typing date-addition logic when iterating? It would be nice if the datetime package had something like: def iterdates(first, last): for day in range((last - first).days +...
2
by: Fabiano | last post by:
Please, i have an webform, that work with a object that receives a DateTime value. I don't want to save date into it. How can i verify if it's value is null or not? Tks Fabiano
3
by: David | last post by:
Hello. How can I get only date or only time from DateTime.Now? For example I want to assign current date and current time to some labels. Thank you.
4
by: M | last post by:
Hello, I have code like dt.DayOfWeek.ToString(CultureInfo.CurrentCulture) where dt is a DateTime object. I get something like "Sunday", "Monday", etc... while I'm expecting it to be in...
3
by: ad | last post by:
I have a DataView, say myDV, it contain a DataTime field, "Birth". I want to get the Birth Value from the DataView: DateTiem dBirth= (DateTime)myDV; But the complier throw an error. How can...
4
by: JD | last post by:
Hi I'm trying to find out how to display a message on a date. I know how to do it in C++, but now i'm learning C# i would also like to do it in this language. This is the code i'm using: using...
4
by: John | last post by:
Hi How can I separate a datetime value into date & time values? Conversely how can I combine date & time values into a single datetime value? Thanks Regards
12
by: conckrish | last post by:
Hi all.. Can anyone tell me how to compare datetime objects?I ve three objects namely Current date,start date and end date.. I need to check the current date with Start date and end date....Plz...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.