Home | Quizes | Downloads | Tech Terms | Tutorials | News | Forum | Site Map | Feedback

ASP Code Samples


There are a few ways to specify time and date on your page. The following codes show you some choices to make.

Simple Date and Time calls.

To get a date with time, you can use <% Now () %>
This gives 3/29/2017 9:48:10 PM

You can retrive date only by using <% =Date() %>
This command returns only date 3/29/2017 on the server's side.
In the same way, guess what <% =Time () %> will return on server side.
If you thought 9:48:10 PM xx:xx:xx AM/PM, then you are right.

Using variables to pass date.

<% dim mydate
mydate = Date()
Response.write ""& mydate & ""
This variable returns 3/29/2017  which is the same as using the now().

The same principle can be used to return time.

Formating your time.
You can use the following formatting structures on your page.

<% =FormatDateTime(Date, X) %>, X being numbers 1 and 2
1 being todays date and time in alphabets.[ Wednesday, March 29, 2017
2 being [ 3/29/2017 ] as regular date.

I hope you found this interesting enough. If you have any suggestions, please post it to the Tech Forum or send us your Feedback

2004 Emefa Amenuvor [i][m][f][t][e][c][h] all rights reserved