Sam Farmer head shot

Sam Farmer

Growing up I never imagined I would play bass guitar for the Dave Matthews Band. And indeed it never happened.

But I have become a passionate and pretty good web developer.


ORM and Dates? You probably want timestamp

Data types for dates and times are slightly different across databases which often makes life difficult for us developers. ColdFusion ORM makes this pretty simple:

  • For a date with time use ormtype="timestamp"
  • Just a date use ormtype="date"

There are no other options!

Full example with the property tag:

view plain print about
1property name="aFullDateWithTime" ormtype="timestamp";
2property name="justADate" ormtype="date";

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
How would I create a MS SQL TimeStamp though?????
# Posted By Darrin | 3/28/12 9:45 AM
Several options:

You can set the database to use timestamp on the column.

You can use the optimistic locking:
http://help.adobe.com/en_US/ColdFusion/9.0/Develop...
And set
property name="lastModified" fieldtype="timestamp";

You could also look into the DDL options:
http://help.adobe.com/en_US/ColdFusion/9.0/Develop...
# Posted By Sam Farmer | 3/28/12 10:07 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.7. Contact Blog Owner