VB format date

In VB (.NET) you can use FormatDateTime(Exp_datetime[,Format]) function to format date and time expression.
The Exp_date argument is the date/time value to be formatted. The Format argument is optional. It represents the format style to be applied to the data/time value. The Format argument can take one of four values as shown below.
-DateFormat.GeneralDate can display both date and time. If there is only date in the date/time expression, the short date is displayed. For the time, the long time is displayed.
-DateFormat.LongDate displays the data in long date form.
-DateFormat.LongTime displays the time in long time form.
-DateFormat.ShortDate displays the date in short date form.
-DateFormat.ShortTime displays the time in short time form.

Module Module1

   Sub Main()
     Dim td = Today 'get current day
     Dim ftd = FormatDateTime(td, DateFormat.LongDate) 'long date format
     Console.WriteLine("Today:{0}", ftd) 'display it
   End Sub
End Module

Posted by: Dara | post date: 02-10-2013 | Subject: VB.NET Programming Language

This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.