Hi
How to format the given date to required format?
How to use the function of dateadd and datediff of vb.net in c#.net?
Please anyone give the code as Iam new to c#.
Thanks
Aruna
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Jun 27, 2007, 8:44 AM
These two links give details of the standard and custom date/time formats available in the .NET Framework and hence to a C# program:
http://msdn2.microsoft.com/en-us/library/az4se3k1(vs.80).aspx
http://msdn2.microsoft.com/en-us/library/8kb3ddd4(vs.80).aspx
The DateTime.Add(), and related methods, give you the same functionality as VB's DateAdd() function and the DateTime Subtraction operator, which yields a TimeSpan, can be used in place of DateDiff():
http://msdn2.microsoft.com/en-us/library/system.datetime_methods(vs.80).aspx
It's also possible to call those functions directly from a C# program but, as this is not really recommended, I won't describe it here.