You are here: Re: What's wrong with this? « PHP SQL « IT news, forums, messages
Re: What's wrong with this?

Posted by Virginner on 10/12/07 11:38

"Mad Hatter" <colin@class31.co.uk> wrote in message
news:1jhtk4i2a7rma.pmfylopjl254$.dlg@40tude.net...
> Hi
>
>>
>> DATE() does not take any parameters - you're getting confused with PHP's
>> date, or SQL's DATE_FORMAT
>> TIME() only returns the time of day
>
> That's where I'm going wrong then. I'm using php commands on a sql query
> :-(
>>
>> Are you sure you have the dob as a Unix Timestamp? That would be weird.
>> Now for example would be "1192147732" in Unix Time.
>
> Yup, definetely Unix timestamp. I prefer storing dates that way.
>>
>> It's more likely you have the dob as a DATE column-type, e.g. 1943-12-31
>> It that's the case, then use:
>
> Thanks but due to unix date no help :-(

(Still don't know why you would store a dob as Unix Timestamp, but anyway)

..... simply convert your UNIX_TIMPSTMP to a normal date/time, using
FROM_UNIXTIME()

So, for example, to get today's day of the yea if it was a Unix Timestamp:

SELECT DAYOFYEAR(FROM_UNIXTIME(UNIX_TIMESTAMP()))

So, to solve your problem:

SELECT numberx FROM member
WHERE DAYOFYEAR(FROM_UNIXTIME(dob))=DAYOFYEAR(NOW())

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация