Brad's Date and Time Function Examples

Result Code Description
10:30:28 AM <% =Time %> Displays current time on server
7/30/2010 <% =Date %> Displays current date
7/30/2010 10:30:28 AM <% =Now %> Displays current date and time
2010 <% =Year(now) %> Displays year
7 <% =Month(now) %> Displays the month number (1-12)
July <% =MonthName(Month(now)) %> Displays month name based on month number
6 <% =WeekDay(now) %> Displays the number of the weekday (0-6)
Friday <% =WeekDayName(WeekDay(now)) %> Displays weekday name based on weekday number
30 <% =Day(now) %> Displays day of the month
10 <% =Hour(now) %> Displays the current hour based on the current time
30 <% =Minute(now) %> Displays the current minute based on the current time
28 <% =Second(now) %> Displays the current seconds based on the current time
7/30/2010 <% =DateValue(now) %> Returns the date portion of the varible
10:30:28 AM <% =TimeValue(now) %> Returns the time portion of the varible

SEASONS -- Based on Date
    Summer

Seasons Code:
<% If Date > #9/21# And Date <= #12/21# Then Season="Fall" ElseIf Date> #12/21# And Date <= #3/21# Then Season="Winter" ElseIf Date> #3/21# And Date <= #6/21# Then Season="Spring" Else Season="Summer" End If %>     <% =Season %>


Message -- Based on Time
Good Morning!

Message Code:
<% If Time > #6:00:00 AM# And Time <= #12:00:00 PM# Then greeting="Good Morning!" ElseIf Time> #12:00:00 PM# And Time <= #5:00:00 PM# Then greeting="Good Afternoon!" ElseIf Time> #5:00:00 PM# And Time <= #12:00:00 AM# Then greeting="Good Evening!" ELSE greeting="What are you still doing up?" End If %>  <% = greeting %> 

~Advertisement~

bradhuggins.com

Home | About Me | Music | Computers | Make a donation | Email Me
Copyright © 2010, BradHuggins.com. All rights reserved