Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2008

Tip: Looking for answers? Try searching our database.

DateTime Adding Parse Help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
coconet - 18 Apr 2008 20:41 GMT
I have a Datetime of "2008-04-17 00:00:00.000" and a Datetime of
"2008-04-18 16:55:28.000", and I need to join them to be

"2008-04-17 16:55:28.000"

What is the best way to parse that?

Thanks.
Peter Duniho - 18 Apr 2008 20:51 GMT
> I have a Datetime of "2008-04-17 00:00:00.000" and a Datetime of
> "2008-04-18 16:55:28.000", and I need to join them to be
>
> "2008-04-17 16:55:28.000"
>
> What is the best way to parse that?

That one example does not sufficiently describe the rules for combining  
the two values.

You certainly can take the Date property from one DateTime and add it to  
the TimeOfDay property from another DateTime.  That's simple enough and in  
the very specific example you provided, it would produce the output you  
describe.

But is that really what you want to do?  If so, why are you using a  
DateTime for the second value in the first place?  Why not just a TimeSpan  
to start with?

Pete
coconet - 21 Apr 2008 21:53 GMT
The datetime values are coming from an antiquated tab-delimited-file
export where the values actually made sense to someone, somewhere.
However in the data-consumer I am writing, I can just use one but I
have to get them together first.

Thanks!

>> I have a Datetime of "2008-04-17 00:00:00.000" and a Datetime of
>> "2008-04-18 16:55:28.000", and I need to join them to be
[quoted text clipped - 16 lines]
>
>Pete
Chris Shepherd - 21 Apr 2008 21:56 GMT
> The datetime values are coming from an antiquated tab-delimited-file
> export where the values actually made sense to someone, somewhere.
> However in the data-consumer I am writing, I can just use one but I
> have to get them together first.

Can you not combine the fields into a single string before parsing?

Chris.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.