[thelist] Storing Time Duration in DB

Jonathan Cone JCone at municode.com
Wed Nov 12 06:33:18 CST 2003


Hi list,
	My primary database is SQL Server 2000.  I'm pretty sure this question may range to other db's also though.  I am trying to store a time duration in a field in the database. For example length of a song, or how long it took to run a mile.  Something along the format of hr:min:sec.  The datetime datatype has this format, but it treats the data as a time, like 1 o'clock PM instead of 1 hour.  I think it would still work, but something seems fundamentally wrong with this.  
	The two other solutions I could think of were to have three seperate numeric fields, hours minutes and seconds, which also seemed wrong, or one field to hold the number of seconds and use the front end to convert to hours minutes seconds.  I'm happiest with the latter, but it just seems like there should be a better way to go about this.  I know I can't be the only one that's ever had this issue.  
	Any help, advice, suggestions would be greatly appreciated!

Thanks,
	Jonathan


More information about the thelist mailing list