Reputation: 9293
CREATE TABLE IF NOT EXISTS `posts` (
`id` int(3) NOT NULL AUTO_INCREMENT,
`user` varchar(9) NOT NULL,
`post` text NOT NULL,
`date` varchar(14) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
table created
INSERT INTO `posts` ( 'user', 'post', 'date') VALUES
('she', 'dolphin', '???');
('me', 'chandra'), '???');
Instead of ???
I need current datetime in the following format:day.month. hour:min
For example for today and now: 03.01. 00:34
Upvotes: 0
Views: 44
Reputation: 449485
That a bad idea, because you are storing the data
Use a proper mySQL DATETIME
field instead, and format the output using DATE_FORMAT
when you make the query:
SELECT DATE_FORMAT(`date`, "%d.%m. %H:%i") FROM `posts`;
Upvotes: 3