Brad's Date and Time Function Examples

Result Code Description
6:18:10 AM <% =Time %> Displays current time on server
1/7/2009 <% =Date %> Displays current date
1/7/2009 6:18:10 AM <% =Now %> Displays current date and time
2009 <% =Year(now) %> Displays year
1 <% =Month(now) %> Displays the month number (1-12)
January <% =MonthName(Month(now)) %> Displays month name based on month number
4 <% =WeekDay(now) %> Displays the number of the weekday (0-6)
Wednesday <% =WeekDayName(WeekDay(now)) %> Displays weekday name based on weekday number
7 <% =Day(now) %> Displays day of the month
6 <% =Hour(now) %> Displays the current hour based on the current time
18 <% =Minute(now) %> Displays the current minute based on the current time
10 <% =Second(now) %> Displays the current seconds based on the current time
1/7/2009 <% =DateValue(now) %> Returns the date portion of the varible
6:18:10 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 © 2009, BradHuggins.com. All rights reserved