I have 2 textboxes on a form that accept dates. I dont have a drop down box, I just let the user enter the date themselves. I then want to take the dates entered from those two boxes and figure out how many days apart they are. I'm not sure what I can use for this. Do anyone know what I should read about to figure this out? Thanks.
photo123
Recommended Answers
Jump to PostSo what dates need to be supported?
Why not use DateDiff? (I already noted where it can fail.)
Jump to PostYou can use
DateTime.Parse()
to convert your string to aDateTime
.DateTime
variables can be subtracted resulting in aTimeSpan
containing the difference.
All 6 Replies
rproffitt 2,572
"Nothing to see here." Moderator
photo123
rproffitt 2,572
"Nothing to see here." Moderator
pritaeas 2,194
¯\_(ツ)_/¯ Moderator Featured Poster
rproffitt
commented:
What do you think about their exclusion of AD and BC dates? +15
tinstaafl 1,176
Posting Maven
pritaeas 2,194
¯\_(ツ)_/¯ Moderator Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.