Re: PHP-MYSQL Date Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

as per my understanding you have to use the mysql function which converts str to date, for example 

insert into <tablename> SET <date column name> = STR_TO_DATE('23/10/2008', '%d/%m/%Y')

this will work for you and you can use any format you like.

Thanks,

Vijay Kumar


--- On Tue, 4/28/09, SoftMasters <s_soft_masters@xxxxxxxxx> wrote:

From: SoftMasters <s_soft_masters@xxxxxxxxx>
Subject: Re:  PHP-MYSQL Date Help
To: php-objects@xxxxxxxxxxxxxxx
Date: Tuesday, April 28, 2009, 9:23 PM











    
            
            


      
      just do this before the insert/update query.

 

$dbDate = date("Y-m-d" , strtotime($formDate ));

 

Regards,

SoftMasters



--- On Tue, 4/28/09, Hari KT <kthari85@yahoo. co.in> wrote:



From: Hari KT <kthari85@yahoo. co.in>

Subject: Re:  PHP-MYSQL Date Help

To: php-objects@ yahoogroups. com

Date: Tuesday, April 28, 2009, 7:23 PM



Hi ,

MySQL store date as YY-MM-DD , something like this 2009-04-15 . So you need to do the appropriate function to convert it . You can use the explode method 



list($month,  $date, $year)  = explode( "/", $data) ;



and combine and store in MySQL . 

Cheers



Hari K T



http://www.harikt. com/

http://ijust4u. blogspot. com/



--- On Tue, 28/4/09, rai.suman <sumanraic001@ yahoo.com> wrote:



From: rai.suman <sumanraic001@ yahoo.com>

Subject:  PHP-MYSQL Date Help

To: php-objects@ yahoogroups. com

Date: Tuesday, 28 April, 2009, 10:34 AM



Hello Everyone!



How is life there, Hope everything is cool and fine.



Actually, I have a problem:



1) I have a Date column in MySQL database.



I insert date from HTML form in 27-04-2009 (dd-mm-yyyy) format.



But in mysql database it stores wrong data like (2704-02-02) like this.



How it happen.



Anybody can help me ?



How to convert MySQL date and PHP DATE ??



Regards & Thank You,



Suman K. Rai



Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads. yahoo.com/ in/firefox/ ?fr=om_email_ firefox



[Non-text portions of this message have been removed]



[Non-text portions of this message have been removed]




 

      

    
    
	
	 
	
	








	


	
	


      

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux