Bluehost.com Web Hosting $6.95

Automatic date setting

This is a discussion on Automatic date setting within the MySQL Database forums, part of the Database Forums category; Hi, I'm looking fo a way to make possible to automatic set the date at the creation of a ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-06-2006
Freedom
 
Posts: n/a
Default Automatic date setting

Hi,
I'm looking fo a way to make possible to automatic set the date at the
creation of a row!

for exemple:

CREATE TABLE News (
IDNews int(10) NOT NULL,
Argument int(3)
references ArgomentoNews(IDArgomento)
on delete set null,
Title varchar(50) NOT NULL,
Body varchar(1000) NOT NULL,
publish_date date,
Autor varchar(20)
references Utente(NomeUtente)
on delete set null,
PRIMARY KEY (IDNews)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

I'd like that when I insert a News into the database the field
'publish_date' is automatically set to the date of the insertion!

Do you know a way?

thanks!

Reply With Quote
  #2 (permalink)  
Old 12-06-2006
Paul Lautman
 
Posts: n/a
Default Re: Automatic date setting

Freedom wrote:
> Hi,
> I'm looking fo a way to make possible to automatic set the date at the
> creation of a row!
>
> for exemple:
>
> CREATE TABLE News (
> IDNews int(10) NOT NULL,
> Argument int(3)
> references ArgomentoNews(IDArgomento)
> on delete set null,
> Title varchar(50) NOT NULL,
> Body varchar(1000) NOT NULL,
> publish_date date,
> Autor varchar(20)
> references Utente(NomeUtente)
> on delete set null,
> PRIMARY KEY (IDNews)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
>
> I'd like that when I insert a News into the database the field
> 'publish_date' is automatically set to the date of the insertion!
>
> Do you know a way?
>
> thanks!


Take a look at
http://dev.mysql.com/doc/refman/5.0/...stamp-4-1.html


Reply With Quote
  #3 (permalink)  
Old 12-06-2006
Freedom
 
Posts: n/a
Default Re: Automatic date setting

On 2006-12-06 20:15:19 +0100, "Paul Lautman"
<paul.lautman@btinternet.com> said:

> Freedom wrote:
>> Hi,
>> I'm looking fo a way to make possible to automatic set the date at the
>> creation of a row!
>>
>> for exemple:
>>
>> CREATE TABLE News (
>> IDNews int(10) NOT NULL,
>> Argument int(3)
>> references ArgomentoNews(IDArgomento)
>> on delete set null,
>> Title varchar(50) NOT NULL,
>> Body varchar(1000) NOT NULL,
>> publish_date date,
>> Autor varchar(20)
>> references Utente(NomeUtente)
>> on delete set null,
>> PRIMARY KEY (IDNews)
>> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
>>
>> I'd like that when I insert a News into the database the field
>> 'publish_date' is automatically set to the date of the insertion!
>>
>> Do you know a way?
>>
>> thanks!

>
> Take a look at
> http://dev.mysql.com/doc/refman/5.0/...stamp-4-1.html


thanks

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:08 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0