Connecting Tech Pros Worldwide Help | Site Map

Date functions

  #1  
Old July 17th, 2005, 05:18 AM
Hayden Kirk
Guest
 
Posts: n/a
Ok

This is really anoying me...

I am using a timestamp colum in my MySQL table, I generate a timestamp with
php using time(); When I pull the time from the table I get some date from
the 1970's... does anyone know whats going on? Im using the date() function
to display the timestamp.

Thanks


  #2  
Old July 17th, 2005, 05:18 AM
Tom Thackrey
Guest
 
Posts: n/a

re: Date functions



On 19-Mar-2004, "Hayden Kirk" <spam@spam.com> wrote:
[color=blue]
> I am using a timestamp colum in my MySQL table, I generate a timestamp
> with
> php using time(); When I pull the time from the table I get some date from
> the 1970's... does anyone know whats going on? Im using the date()
> function
> to display the timestamp.[/color]

Without seeing your code I would guess that you are inserting the time()
directly into the timestamp column. This won't work because mysql is not
expecting a unix timestamp. Change the column type to int or insert a proper
mysql time.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
  #3  
Old July 17th, 2005, 05:18 AM
Hayden Kirk
Guest
 
Posts: n/a

re: Date functions


Ah ok

That is the problem

What is the mysql time format? I thought it was a unix time stamp?

Could I get a breif example please...

I know this is a linux n00b question... but why do dates start at 1970?

Thanks

"Tom Thackrey" <use.signature@nospam.com> wrote in message
news:J8L6c.26357$sd2.10338@newssvr29.news.prodigy. com...[color=blue]
>
> On 19-Mar-2004, "Hayden Kirk" <spam@spam.com> wrote:
>[color=green]
> > I am using a timestamp colum in my MySQL table, I generate a timestamp
> > with
> > php using time(); When I pull the time from the table I get some date[/color][/color]
from[color=blue][color=green]
> > the 1970's... does anyone know whats going on? Im using the date()
> > function
> > to display the timestamp.[/color]
>
> Without seeing your code I would guess that you are inserting the time()
> directly into the timestamp column. This won't work because mysql is not
> expecting a unix timestamp. Change the column type to int or insert a[/color]
proper[color=blue]
> mysql time.
>
> --
> Tom Thackrey
> www.creative-light.com
> tom (at) creative (dash) light (dot) com
> do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)[/color]


  #4  
Old July 17th, 2005, 05:19 AM
Tom Thackrey
Guest
 
Posts: n/a

re: Date functions




On 19-Mar-2004, "Hayden Kirk" <spam@spam.com> wrote:
[color=blue]
> What is the mysql time format? I thought it was a unix time stamp?
>[/color]

The manual is your friend:
http://www.mysql.com/doc/en/Date_and_time_types.html

[color=blue]
> Could I get a breif example please...[/color]

'2004-03-19 12:00:00'
[color=blue]
>
> I know this is a linux n00b question... but why do dates start at 1970?[/color]

The Unix timestamp was the system time on the original Unix systems. There
was no need for dates prior to 1970, so it was defined as the number of
seconds since Jan 1, 1970.



--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Date Functions as variables IntraRELY answers 3 November 20th, 2005 07:52 AM
Date functions in c# Kiran answers 5 November 16th, 2005 11:21 AM
FInding the days between 2 dates without using the inbuilt date functions or the DateTime Type Russell answers 4 November 16th, 2005 02:51 AM
Problems with using date functions sylvian stone answers 1 July 24th, 2005 10:25 PM