Naming "timestamps"

G

Gary Schuldt

I want to use the Now() function, which returns both the current date and
time.

I need some sage advice on what to name the database field I store this
value in. I could call it DateCreated, but it's more than just a "date",
since it includes hour/min/sec etc., too.

I could call it TimestampCreated, but it's more than just a time-stamp--it
also has "date" in it!

What's the Best Practice on naming such fields so that the names are not
(too) misleading?

Thanks!

Gary
 
A

Armen Stein

I want to use the Now() function, which returns both the current date and
time.

I need some sage advice on what to name the database field I store this
value in. I could call it DateCreated, but it's more than just a "date",
since it includes hour/min/sec etc., too.

I could call it TimestampCreated, but it's more than just a time-stamp--it
also has "date" in it!

What's the Best Practice on naming such fields so that the names are not
(too) misleading?

Thanks!

Gary

We call it CreateTS in our shop. I think "timestamp" can imply a date
too. Doesn't really matter as long as you're consistent.

--
Armen Stein
Access 2003 VBA Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0764559036/jstreettech-20
J Street Technology, Inc.
Armen _@_ JStreetTech _._ com
 
J

John Vinson

I want to use the Now() function, which returns both the current date and
time.

I need some sage advice on what to name the database field I store this
value in. I could call it DateCreated, but it's more than just a "date",
since it includes hour/min/sec etc., too.

I could call it TimestampCreated, but it's more than just a time-stamp--it
also has "date" in it!

What's the Best Practice on naming such fields so that the names are not
(too) misleading?

I usually just call such fields Timestamp or TimestampCreated, and
document it. De gustibus non disputandnum est however.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
G

Gary Schuldt

Thanks, Armen.

That fits with my conventions of putting the "class word" (e.g., date,
time, percent, description) at the end--in this case "TS"--and the
modifier--Created or Modified--preceding it. So there could be a CreatedTS
and a ModifiedTS, both set using Now() in the appropriate contexts.

Gary
 
G

Gary Schuldt

Thanks, John.

Yes, I agree with "De gustibus . . . " when it's purely arbitrary; I just
wanted to poll the experts, since lotsa times I have to defend my
programming decisions.

It seems in this case that the most defensible choice would be DateTime to
characterize the type of value Now returns. So I think my names are going
to be CreatedDateTime and ModifiedDateTime. If I'm just interested in the
date, I can use the DateValue function on the result.

Gary
 
J

John Vinson

It seems in this case that the most defensible choice would be DateTime to
characterize the type of value Now returns. So I think my names are going
to be CreatedDateTime and ModifiedDateTime. If I'm just interested in the
date, I can use the DateValue function on the result.

Sounds good to me!

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
J

Jamie Collins

John Vinson said:
Sounds good to me!

I try to avoid reserved words. TIMESTAMP is an ODBC reserved word and
a SQL Server 'future' reserved word.

I also try to avoid using data types in column names. DATETIME is a
native Jet data type (and reserved word!) I think it would be fairly
intuitive in context that columns named 'Created' and 'Modified' were
of type DATETIME.

Jamie.

--
 
G

Gary Schuldt

I guess we could extend Jamie's idea to WhenCreated, WhenModified; I'm also
keeping track of ModifiedBy <username>. The more intuitive / less
misleading the name, in my book, the better programming, easier maintenance.

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top