[wplug] OT: Any MySQL gurus? Quick easy question..

John Harrold jmh17 at pitt.edu
Wed Jul 28 16:40:38 EDT 2004


Sometime in July Chris assaulted the keyboard and produced:

| 
| Just a little tip.  When ever I am working with dates I try to use the
| following format.
| yyyymmdd
| 
| This makes searching a lot easier.  I ran into a few problems using
| mm-dd-yy.  Now I just have a php function that will take a date from
| either mm-dd-yy or mm-dd-yy and convert it to yyyymmdd and the other way
| for displaying.

I prefer to store dates as unix timestamps. It's an integer so it doesn't
require a special data type. Also, it's easy to sort by and most languages
have handy mechanisms for converting NNNNNN to yyyy-mm-dd, or whatever
format you require, e.g. in perl Date::Manip.

Of course I'm going to have big problems in 2038 or whatever ;).

-- 
---------------------------------------------------------- 
                            | /"\                         
 john harrold               | \ / ASCII ribbon campaign   
 jmh at member.fsf.org      |  X  against HTML mail       
 the most useful idiot      | / \                         
----------------------------------------------------------
 What difference does it make to the dead, the orphans, 
 and the homeless, whether the mad destruction is brought 
 under the name of totalitarianism or the holy name of 
 liberty and democracy?
 --Gandhi
----------------------------------------------------------
  gpg --keyserver keys.indymedia.org --recv-key F65A739E
----------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://penguin.wplug.org/pipermail/wplug/attachments/20040728/fb9dd0ed/attachment-0001.bin


More information about the wplug mailing list