[thelist] Questions
.jeff
jeff at members.evolt.org
Sat Jun 16 14:40:09 CDT 2001
bill,
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: hsport
:
: I am new to ColdFusion [...]
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
documentation is your friend. if you have cfstudio installed, i encourage
you to familiarize yourself with the tags and functions reference sections.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: 1) How do I create a date object in ColdFusion
: (mm-dd-yy) format to appear at the top of the
: page?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now() is the function to create a date object relevant to the current
date/time of the server. If you want to format that, then use the
DateFormat() function.
If you're using cf studio, then in your menu bar go to Tools > Expression
Builder. expand Expression Elements > Functions > Date and Time. There are
a whole bunch of functions listed that help you work with the date object.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: 2) On a form I have separate fields for inputting
: a phone area code, phone prefix and a phone
: suffix. How would I combine those into one
: variable, formatted as (555)121-2121, to be
: inserted in a database field phone?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
you could either do it in the insert statement itself or in another variable
that's used in the insert statement.
option 1
<cfquery name="myquery" ...>
INSERT INTO myTable (phone)
VALUES ('(#form.phone_areacode#)#form.phone_prefix#-#form.phone_suffix#')
</cfquery>
option 2
<cfset phone = "(" & form.phone_areacode & ")" & form.phone_prefix & "-" &
form.phone_suffix>
<cfquery name="myquery" ...>
INSERT INTO myTable (phone)
VALUES ('#phone#')
</cfquery>
good luck,
.jeff
http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/
More information about the thelist
mailing list