A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
MySQL Date field , how to assign current date as default value ?
Joined: Jul 14, 2005
Sep 20, 2006 05:21:00
Thank you for reading my post
i want to ask how i can assign current date as a default value of a filed when i create the table ?
i am using mysql.
Joined: Sep 06, 2003
Sep 20, 2006 06:06:00
Hope this helps you
create table tmp (id int,created_dt timestamp default current_timestamp);
You may use insert stmt like
insert into tmp(id) values (123);
created_dt column is assigned the current date time ...Is it what you want?
I agree. Here's the link:
subject: MySQL Date field , how to assign current date as default value ?
How to use a Timestamp as the Identifier
XSD : default current date
MySQL - Date/Time and Timestamp Issues
Java date to MySQL date conversion
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014