Current location: Hot Scripts Forums » Programming Languages » PHP » date format for mysql


date format for mysql

Reply
  #1 (permalink)  
Old 07-25-03, 06:23 PM
runya runya is offline
Newbie Coder
 
Join Date: Jul 2003
Location: Toronto
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
date format for mysql

I need some help with configuring my guestbook which runs on php and mysql. I need to migrate old data from my old guestbook to the current one. The problem i have is the way the dates are saved to the database. For example Wed 23 Jul 2003 14:02:19 EDT is saved as 1058983339.
Thu 24 Jul 2003 10:32:35 EDT
is saved as 1059057155.

Thanks in advance.
__________________
zimcanada.com
Reply With Quote
  #2 (permalink)  
Old 07-26-03, 04:28 AM
ChristGuy ChristGuy is offline
Operations Support Develo
 
Join Date: Jun 2003
Location: Rivonia, South Africa
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Greetingz....

Try using the following:
PHP Code:

  echo Date("r"1059057155); 

On my system this displays Thu, 24 Jul 2003 16:32:35 +0200

So just replace the date display with the one above... and it should work...
__________________
Till We Meet Again...
Clifford W. Hansen
Aspivia (Pty) Ltd

"We Have Seen Strange Things Today!" Luke 5:26
Reply With Quote
  #3 (permalink)  
Old 07-26-03, 08:09 AM
runya runya is offline
Newbie Coder
 
Join Date: Jul 2003
Location: Toronto
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
I am not sure i understand. The dates appear as Thu, 24 Jul 2003 16:32:35 +0200 on the live page allthough the database records 1059057155.

If it is possible i want to change how the data is stored, that is if i can have it stored as Thu, 24 Jul 2003 16:32:35 (as opposed to 1059057155 ) it will be great. If this not possible i want to know how Thu, 24 Jul 2003 16:32:35 gets converted to 1059057155.
__________________
zimcanada.com
Reply With Quote
  #4 (permalink)  
Old 07-28-03, 12:56 AM
ChristGuy ChristGuy is offline
Operations Support Develo
 
Join Date: Jun 2003
Location: Rivonia, South Africa
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Greetingz...

The date is currently stored as a Unix Time stamp... I find them easier to work with as you don't need to convert them for use with Date.

The only other MySQL format you could use would be Date which is in the format YYYY-MM-DD.

for an explanation of PHP Date() go here: http://www.php.net/date

hope this helps...
__________________
Till We Meet Again...
Clifford W. Hansen
Aspivia (Pty) Ltd

"We Have Seen Strange Things Today!" Luke 5:26
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am not getting time even i set date propery to date/time skchakri ASP 3 09-30-03 04:47 PM
Date From Access 2000 Database Kaikki ASP 4 09-25-03 06:04 PM
date reformatting... dsumpter PHP 1 09-23-03 01:05 AM
Date format alanrenouf PHP 2 07-17-03 04:28 AM
selection of dup recs by latest date atworx Hot Scripts Forum Questions, Suggestions and Feedback 0 06-24-03 11:05 PM


All times are GMT -5. The time now is 05:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.