Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
convert date format in mysql table with php
Old 03-08-2011, 01:55 PM convert date format in mysql table with php
Junior Talker

Posts: 1
Name: daryl
Trades: 0
Ok so i have a csv text file with the following columns in it:
Start Time End Time
JAN 24 17:50:52 20100 JAN 24 17:51:01 2011

I have imported the data in mysql table fine , now i want to convert the data to the correct datetime stamp(0000-00-00 00:00:00) so i did the following:

PHP Code:
$result=mysql_query("select * from telelogs");
 
while(
$row mysql_fetch_array($result)){
        
$my_time$row['Start Time'];
        
$ne=strtotime($my_time);
        
$new=date('Y-m-d H:i:s',$ne);
        
$neww=mysql_query("update telelogs set 'Start Time' = '$new' where 'Start Time' = '$my_time'");
       echo 
"<br />";

But it does not work , am i on the right track here or not?

Last edited by chrishirst; 03-08-2011 at 04:12 PM..
laryldamble is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-11-2011, 06:55 PM Re: convert date format in mysql table with php
Super Spam Talker

Posts: 880
Name: Paul W
Trades: 0
You should be importing that part of the data to a DATE object - then you can extract it in any format you want.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to convert date format in mysql table with php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15322 seconds with 12 queries