Y o u r   F i r s t   C o l d F u s i o n   W e b   P a g e

In the example below, the difference between the HTML code and the HTML/ColdFusion code is the addition of the <cfoutput></cfoutput> tags and the complex-looking #DayofWeekAsString(DayofWeek(Now()))#.

HTML
<html>
<body>
<h3>Hello World, it's Wednesday</h3> 
</body>
</html>
ColdFusion
<html>
<body>
<cfoutput>
<h3>Hello World, it's #DayofWeekAsString(DayofWeek(Now()))#</h3>
</cfoutput>
</body>
</html>
Result...correct one day in seven.

Hello World, it's Wednesday
Result... correct everyday.

Hello world, it's Friday

The <cfoutput></cfoutput> tags inform ColdFusion to process any code found between # symbols. In the example above three ColdFusion functions are used; the Now() function, the DayofWeek() function and the DayofWeekAsString() function.

  • The Now() function returns the current date and time.
  • The DayofWeek(date) function, when given any date, returns a number for that date (1 Sunday to 7 Monday).
  • The DayofWeekAsString(number) function, when given a number from 1 to 7 returns the corresponding day for that number (1 Sunday to 7 Monday).

ColdFusion processed the functions from the inside out, starting with the Now(), then the DayofWeek() and finally the DayofWeekAsString() before displaying the final result.

Tip: Coldfusion statements are not case sensitive - dAYoFwEEkAsstrINg is the same as DayofWeekAsString.

  Running ColdFusion on your PC >>>

copyright 2003 Xhost Ltd All rights reserved