I have the following code in vb –
tAvailableDate = DateAdd("d", 21, Format(Now, gDATEFORMAT))
I am attempting to convert this into C#.
I have converted this so far –
tAvailableDate = DateAdd("d", 21, Format (DateTime.Now, Global.gDATEFORMAT));
But I cannot find a replacement for the DateAdd() or Format() feature.
Any ideas? Thanks.
DateAddis an old VB6 method that was carried over into VB.NET for backwards compatibility. You could get it to work in C# as well if you included theMicrosoft.VisualBasicnamespace in your C# project, but I wouldn’t recommend using the method in C# or VB.NET. Here’s how you should be doing it (it’s easier to read too):