ASP DATE SCRIPT HOME
 
 
PERSONAL DOCUMENT
INTRODUCTION
  MAIN PAGE
CURRICULUM VITAE
  CV ENGLISH
PORTFOLIO
  MY PORTFOLIO

MAIL ME



ASP Date and Time Script

 
Displaying the Current Date and Time
The date and time described in this section are those that are on the server.
 
Date
To display the current date by itself in a Web page, type:
<% =date %>
at the point where you want it to appear. When you view the page in your browser, you should see something like this:
Thu, Jan 23, 1997

Note: Even though "=date" is a short script, it's actually made up of two parts. The "date" part tells the server, "Get me the date." The equal sign (=) tells the server to display the date in the Web page. If you typed just:

<% date %>
the server would get the current date from your system, but that's all. It wouldn't display it. There are times when it makes sense to use an ASP function without the equal sign.
 
Time
To display the current time by itself, type:
<% =time %>
where you want it to appear. When you view the page, you should see something like this:
4:19:46 PM

Now (Date and Time)
To display the current date and time, type:
<% =now %>
where you want them to appear. When you view the page, you should see something like this:
1/23/97 4:19:46 PM .
 
Changing the Way Date and Time are Displayed
You can also use Active Server Pages (ASP) functions to customize the way the current date and time are displayed on your Web page. To do this, use the now function together with the following formatting functions.
 
Month and Monthname
To display the number of the current month in a Web page, type:
<% =month(now) %>
where you want it to appear. When you view the page in your browser, you'll see a 1 if the current month is January, 2 if it's February, and so on.
To display the name of the current month, type:

<% =monthname(month(now)) %>
where you want it to appear.
Day
To display the day of the current month, type:
<% =day(now) %>
where you want it to appear. When you view the page, you'll see a number between 1 and 31.
Year
To display the current year, type:
<% =year(now) %>
where you want it to appear.
Example
Suppose you wanted to display today's date as day/month/year instead of month/day/year. To do so, you would use the day, month, and year ASP functions together, by typing:
<% =day(now) %>/<% =month(now) %>/<% =year(now) %>
When you viewed the page, you would see something like this:
23/1/1997

Later we'll see how you can change this so only the last two digits of the year are displayed, like this:

23/1/97

Weekday and Weekdayname
To display the day of the week as a number from 1 to 7 in a Web page, type:
<% =weekday(now) %>
where you want it to appear. When you view the page in Internet Explorer, you'll see a 1 if today is Sunday, 2 if it's Monday, and so on.
To display the day of the week by name, type:

<% =weekdayname(weekday(now)) %>
where you want it to appear.
Hour, Minute, and Second
To display just the hour part of the current time, type:
<% =hour(now) %>
where you want it to appear. The hour function is based on a 24-hour clock. When you view the page, you'll see a number between 0 and 23.
To display just the minutes part of the current time, type:

<% =minute(now) %>
where you want it to appear. When you view the page, you'll see a number between 0 and 59.
To display just the seconds part of the current time, type:

<% =second(now) %>
where you want it to appear. When you view the page, you'll see a number between 0 and 59.
Example
Try typing this into a Web page:
The time is <% =time %>. That means it's <% =minute(now) %>
minutes past <% =hour(now) %> o'clock.
When you view the page in Internet Explorer, you should see something like this:
The time is 1:36:05 PM. That means it's 36 minutes past 13 o'clock.

Remember, the hour function is based on a 24-hour clock.
 
 

 

 

DOWNLOAD
FILE (PDF)

 

 

 

: "dikutip dari berbagai sumber."


RESOURCES
FREEWARE
  Change Type 1.0
Clear Template 1.0
Cryptext 3.3
HJ Split 2.2
TweakUI W98
Winamp 5.02
SHAREWARE
  Linguist 1.0
Picaview 1.31
SafeClean 3.02
Winhex 10.54
Winrar 3.11
Winzip 9.0

TUTORIAL
PAINT SHOP PRO 7
  Installing
Customizing
Paint Tools
Draw Tools
Preset Shape Tools
Image Menu
Picture Frames
Effects Menu
HTML SCRIPT
  Text
Button
Color
Menu
Image
Background
Clocks
Cookie
ASP SAMPLES
  Date and Time
Instructions
Variables dan Form
Array
Folder dan Files
Database
Random Number
Cookie

MAIL RESOURCES
MAIL TUTORIAL

© Copyright 2003 - 2004, Nikofantacy. All rights reserved.