Re: Insert in DATETIME field

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

 



TechLDS wrote:
> Grab the time from php and concat the values 

why?  he doesn't need the time.  no use in making another step.


> I have this:
>  $day = substr($data_nascimento, 0, 2);
>  $month = substr($data_nascimento, 3, 2);  $year = substr($data_nascimento,
> 6, 4);
> 
> How can I insert that in a DATETIME field in MySQL?


$mydatetime = $year .'-'. $month .'-'. $day .' 00:00:00';

INSERT INTO yourtable
(time)
values
($mydatetime)




PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



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

  Powered by Linux