ASP.Net VB DateTime Functions

by top54u.com 22 Jul, 2008

In ASP.Net VB DateTime object of System Date Structure that provides the functions and properties to get the server DateTime in different format. ASP.Net VB DateTime consists of Now property that can be accessed directly in the code to get the current instance of Date and time of the Server. You can also customize the VB DateTime output into your required formats such as MM-dd-yyyy, dd/MM/yyyy etc. Here we will learn the use of inbuilt functions of DateTime to retrieve the current Date and Time on the Server.

 

Examples of ASP.Net VB DateTime Functions

 

' Displays the current Date and Time

Response.Write(DateTime.Now())

Response.Write("<br>")

 

' Displays current time span of the day

Response.Write(DateTime.Now.TimeOfDay())

Response.Write("<br>")

 

' Displays Short Time string in hh:mm tt format

Response.Write(DateTime.Now.ToShortTimeString())

Response.Write("<br>")

 

' Displays Long Time string in hh:mm:ss tt format

Response.Write(DateTime.Now.ToLongTimeString())

Response.Write("<br>")

 

' Displays Long Date String in dddd, MMMM dd, yyyy format

Response.Write(DateTime.Now.ToLongDateString())

 

 

Above ASP.Net VB DateTime Functions return the following output:

7/22/2008 12:11:04 PM
12:11:04.0968750
12:11 PM
12:11:04 PM
Tuesday, July 22, 2008
7/22/2008

Spotlight.....

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , , , ,

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

10/11/2008 3:23:10 AM




related videos.....
recent posts.....
top54u ezines.....