Monday, March 26, 2012

This easy 2 lines in 1 line of code

Dim myDate As Date = Now
todaysdate.text = FormatDateTime(myDate,vblongdate)

cant this be done in 1 line of code?No it cant.
How about todaysdate.text = FormatDateTime(Now,vblongdate). You can eliminate the variable entirely.. of course if you need the variable then you must declare it and initialize it on a seperate line.

I don't know of any languages that would let you declare a variable in a function call. If there are it's probably bad form to do so anyways.
Sure.

FormatDateTime( DateTime.Now, vblongdate )
thx fellas

0 comments:

Post a Comment