Jump to content


Photo

date columns


  • Please log in to reply
4 replies to this topic

#1 natalieG

natalieG
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 29 May 2006 - 01:11 AM

we have a TABLE with column descrived as DATE1 DATE
if we store strings in this field as yyyy-mm-dd =2006-07-12
can this colum be used foir sorting as:
SELECT * FROM TABLE ORDER NY DATE1 DESC

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 29 May 2006 - 01:14 AM

What happens when you try it?
Legend has it that reading the manual never killed anyone.
My site

#3 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 29 May 2006 - 07:21 AM

Yes you can. I would however recommend you to convert them to UNIX timestamps.

They have usually 10 digits and are easier to handle.
~ D Kuang

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 29 May 2006 - 09:29 AM

@poirot

I was born in 1949 - try storing my date of birth in a UNIX timestamp.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 29 May 2006 - 05:03 PM

[!--quoteo(post=378029:date=May 29 2006, 02:29 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ May 29 2006, 02:29 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
@poirot

I was born in 1949 - try storing my date of birth in a UNIX timestamp.
[/quote]
Yes, it's a problem. Wow, you're older than my father.
There are some code snippets for extended timestamps though. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
~ D Kuang




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users