For Adobe ColdFusion application servers Date

Date interprets an entered value based on the page's locale, and internationalizes it for storage in a database. For example, if you have set the locale to English (US), then the date 1/6/2012 will be interpreted as the sixth day of January 2012. However, if your locale is English (UK), that same date will be interpreted as the first day of June 2012. Since web sites are an international medium, this is a serious issue. So the default format for the date datatype is calendar. Visitors can pick a date, reducing confusion. It is also a good idea to specify the date formatting you are expecting, for example: (year-month-day). The structure, request.terraform.locale contains a range of localization data. You can vide it with cfdump or by turning your form's debugging on with the cf_terraform debug attribute. request.terraform.locale.shortDateHint is particularly useful: this is a human-friendly guide to the date, e.g. day / month / year.

To change the localization setting of your form, use the ColdFusion fnction SetLocale(). Another option to consider is dynamic client locale evaluation, whereby TerraForm sets the locale of the form based on the client browser settings. Thus a visitor in the US can enter 1/6/2012 and a visitor in Sweden can enter 2012-1-6 and both will be internationalised as {ts '2002-01-06 00:00:00'} (the standard CF date format). You can set TerraForm to do this using the cf_terraform DynamicLocale attribute.

Examples

A regular date field:

<cf_terrafield
  name="Date1"
  datatype="date"
  caption="your arrival date"
  required="true"
/>
<div>
  <cfoutput>
    #Request.TerraForm.DateHint#
  </cfoutput>
</div>
 *
month / day / year

A date field using the text format:

<cf_terrafield
  name="Date2"
  datatype="date"
  caption="your departure date"
  format="text"
  required="true"
  prompt="#Request.TerraForm.DateHint#"
/>

 *

A date in the future:

<cf_terrafield
  name="Date3"
  datatype="date"
  caption="your preferred date"
  min="#Now()#"
/>


Fields marked with  * are required.

No comments yet