incorrect time :S

This is a discussion on "incorrect time :S" within the PHP Forum section. This forum, and the thread "incorrect time :S are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 21st, 2007, 19:30
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
incorrect time :S

I get a mysql error when inserting the variable time with value time() saying that it's the incorrect format.
the column is called timestamp and is type timestamp with default current timestamp
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote

  #2 (permalink)  
Old Sep 21st, 2007, 19:35
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: incorrect time :S

oh i think i need to use integer for the type..
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #3 (permalink)  
Old Sep 21st, 2007, 19:38
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: incorrect time :S

Mysql timestamps are completely different to PHP time.

PHP uses unix timestamps - num of seconds since the epoch.

MYsql timestamps have the format

'YYYY-MM-DD HH:mm:SS'

mySQL can work with a much larger date range then PHP.

I find that making a column with an integer value works for simple logging via PHP.

Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #4 (permalink)  
Old Sep 21st, 2007, 19:57
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: incorrect time :S

Quote:
Originally Posted by Rakuli View Post
Mysql timestamps are completely different to PHP time.

PHP uses unix timestamps - num of seconds since the epoch.

MYsql timestamps have the format

'YYYY-MM-DD HH:mm:SS'

mySQL can work with a much larger date range then PHP.

I find that making a column with an integer value works for simple logging via PHP.

Cheers,
yeah that's what i did
gotta find my code to convert it to a date now
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #5 (permalink)  
Old Sep 21st, 2007, 20:01
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: incorrect time :S

PHP: Select all

date("d/m/Y"$var); 

Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
My first time jabo Introduce Yourself 3 Feb 26th, 2008 17:33
Spacing between list items incorrect when span tag is used in a list item... MikeTheVike Web Page Design 5 Apr 18th, 2007 01:52
Line 1: Incorrect syntax near '='. dc ASP.NET Forum 1 Sep 8th, 2005 12:10
layout sits incorrect in smaller window, hit F5 to fix! crite Web Page Design 1 Jul 6th, 2005 17:05
Adjusting time from server time to local time Tim356 Classic ASP 10 Jun 21st, 2004 14:57


All times are GMT. The time now is 20:56.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43