Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
save a datetime like (05/03/2008 11:10:15 AM) "with the exact format" to a text file.
read it from the text then have it as a datetime value.
____________________________________________
how to find out which DateTime is bigger? how much bigger(e.g. date1 is 152 seconds bigger than date2)?
Posted
Updated 24-Jun-12 2:05am
v2
Comments
Sergey Alexandrovich Kryukov 25-Jun-12 3:25am    
What's wrong? Is you MSDN help broken? I hope you were not banned by Google or Bing. Or... were you? :-)
--SA

We don't do your homework for you. That isn't how you learn. We are here to help you, not hurt you in the long run. Giving you the answer would only hurt you in the long run. What are you going to do in the future, when your job is on the line (or your job interview)? Give this problem a shot. Try something (anything) and see how it works. Break down the steps and figure out how to do each one. Come back here if you have a question about the code (and you have a code sample). We are happy to help clarify things. We just won't do your work for you.
 
Share this answer
 
Comments
mrmarzban 24-Jun-12 8:29am    
OMG!
this is not a homework.
i'm a php programmer.
am just a beginner in c#.
try not to read people mind, your so weak at it.
if you know the answer to this question, and don't want to give me all the answer. you can just give me the keyword i'll search and learn it myself.
thank you mr.clever.
Sandeep Mewara 24-Jun-12 8:35am    
If that's the case what you say then why your question does not ask for keywords and direction for help? Why does it just say the 'problem statement' without any other content from your side on what you did or what exactly you are looking for?

BTW, you did post last line correctly. Tim is smart and clever enough to solve the problem asked by you.
Sandeep Mewara 24-Jun-12 8:36am    
Just to be more clear(probably a rephrase of Tim's answer) on how things work here and what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Sandeep Mewara 24-Jun-12 8:47am    
Oh! Just came across this: http://www.codeproject.com/Questions/409390/DateTime-read-from-txt-file

Looks like you already were given 'direction and keywords', yet you post here the same thing as a new question with no details on what specific issue you are dealing with.

:)
Maciej Los 24-Jun-12 9:48am    
It looks like an answer. My virtual 5!
To answer first question: use the operators <, >, <= or >= with DateTime operands; they are all defined properly.

To answer the second question: use the operator '-' (subtraction), it returns the value of the type System.TimeSpan.

Please see:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^],
http://msdn.microsoft.com/en-us/library/system.timespan.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900