|
Posted by Captain Paralytic on 10/12/07 11:08
On 12 Oct, 11:34, Mad Hatter <co...@class31.co.uk> wrote:
> 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 :-(
Well, let's look at this.
Most of us when using a tool like a database system choose the most
appropriate facilities, to ensure efficiency and ease of maintenance.
You think you know better and choose to store times as unix times.
Next, you have proved that you could not be bothered to check your
problem in the manual. If I get a syntax error, I go to the manual to
see what I've done wrong. There you would have seen that you were
using totally the wrong syntax and would have seen the correct one.
When I want to do something and I'm not sure how to, I try searching
Google or the manual.
Putting the words
mysql unix timestamp
into Google brings up the correct page of the mysql user manual as the
first hit. Going to that page (by the way, that'sthe page you would
already have been on had you bothered to llok up he syntax error) and
searching for UNIX, you would have hit straight upon the FROM_UNIXTIME
function.
So, not only do you "prefer" not to store times properly, you also
"prefer" not to bother looking at the manual or doing any other
obvious searches to help yourself. You "prefer" to get other people to
sort out your messes for you.
Navigation:
[Reply to this message]
|