Jump to content

Problems using date...


virruss2

Recommended Posts

Hi,

 

I have a little problem with the creation date of some webpages when trying to sort them by date.

I've stored my dates as strings, in this format: 1/08/08 (day/month/year - I've used j/m/y if I remember correctly).

Now I need to select only webpages from a particular range of time, but I cannot compare strings... For example, I need:

 

SELECT * FROM 'mytable' WHERE date > '$my_date'

 

but my date field is a string.

 

Any idea? Thank you in advance.

Link to comment
Share on other sites

You said that you stored your dates into your table as a string using date("m/d/y") or whatever. strtotime() turns string time into unix epoch time. You could do...

 

SELECT foo FROM bar WHERE time='$var1-$var2-$var3'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.