473,770 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question about datetime column in mysql

Hey there,
i tried this question in the mysql group, but have not heard anything.
i have a database with about 20 tables. The some of these tables have
datetime type columns in them. What i am basically wondering is if
there is a way to make a default value of now() apply if it is not
specified when the row is created.
i know this is possible with a timestamp, but is it possible with a
datetime column ? and if so, how ?

Oct 29 '06 #1
2 1330
nephish wrote:
Hey there,
i tried this question in the mysql group, but have not heard anything.
i have a database with about 20 tables. The some of these tables have
datetime type columns in them. What i am basically wondering is if
there is a way to make a default value of now() apply if it is not
specified when the row is created.
i know this is possible with a timestamp, but is it possible with a
datetime column ? and if so, how ?
Re-ask your question in that newsgroup - it might have gotten lost the
first time (did you wait at least 24 hours for a response?). Or try
another mysql newsgroup - such as comp.databases. mysql - or the mailing
list on mysql.com.

A php newsgroup is not the correct place for MySQL questions.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Oct 29 '06 #2
ok, sorry for that.
shawn

On Oct 28, 10:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
nephish wrote:
Hey there,
i tried this question in the mysql group, but have not heard anything.
i have a database with about 20 tables. The some of these tables have
datetime type columns in them. What i am basically wondering is if
there is a way to make a default value of now() apply if it is not
specified when the row is created.
i know this is possible with a timestamp, but is it possible with a
datetime column ? and if so, how ?Re-ask your question in that newsgroup - it might have gotten lost the
first time (did you wait at least 24 hours for a response?). Or try
another mysql newsgroup - such as comp.databases. mysql - or the mailing
list on mysql.com.

A php newsgroup is not the correct place for MySQL questions.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Oct 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9461
by: Phil Powell | last post by:
I have a mySQL database table with a column field datatype of datetime that I set up in the original create table statement like this: create table nnet_usermetadata ( .... nnet_record_entered datetime default 'now()' ) However, upon execution, each time a record is entered into nnet_usermetadata the results are:
3
10377
by: Phil Powell | last post by:
I am unable to determine which version of mySQL is running on a remote server (and the client doesn't know either, and I can't reach the host.. oh what I'll do for $80)... create table if not exists fs_usermetadata ( fs_userid int not null, primary key(fs_userid), fs_username varchar(255) not null, fs_password varchar(255) not null, fs_user_category_id int not null,
0
4892
by: PAUL MENARD | last post by:
--0-930715088-1061086093=:22602 Content-Type: text/plain; charset=us-ascii Hello All, I'm having trouble understanding the MySQL docs on how to subtract two DATETIME values. I have two tables that have a DATETIME column. In my SELECT I am doing a JOIN to bring in both sets of rows. What I want is to subtract the DATETIME values to determine the number of seconds between their time. In the WHERE clause I also want to filter the selected...
0
1491
by: Manny | last post by:
Great that worked! I would also like to only provide a date in the where clause and not a timestamp (the field is of type datetime). I have tried using the date function but it does not appear to work. I tested the date function as per mysql manual(http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html) but I get the following error: SQL-query:
3
5226
by: heroe | last post by:
Hello *, i write you with an urgent problem. I would like to create forign keys to datetime field, but it doesn't seem to work. I get Can't create table '.\sampleDB\student_module.frm' (errno: 150) error. the tables look like CREATE TABLE IF NOT EXISTS sampleDB.student ( student.from1 DATETIME not null, student.from2 DATETIME not null,
13
3302
by: Roy | last post by:
Hi all, I'm creating a project that should always use this date format when displays the dates or create dates. The back end database is a SQL Server and I like to know what is the logical way to configure server, sql server or program so it always deals with date as mm/dd/yyyy format. Thanks in advance. Roy
3
3430
by: laredotornado | last post by:
Hi, I have two columns, both MySQL 4 DATETIME types ... TABLE1.depart_day TABLE2.depart_day and both are indexed. The problem is, all of TABLE1's dates have a time of midnight (e.g. 2006-03-08 00:00:00" while TABLE2's columns have times (e.g. 2006-03-08 12:45:00). I want to match rows where TABLE1
7
6113
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
1
4725
by: ojorus | last post by:
Hi! A simple question maybe... I have a datetime column in a table, and want to automaticly insert local (Norwegian) time into the column. (I use PHP 5) I can not use NOW() since the mysql server is set up with a different time zone. So now i use UTC_TIMESTAMP() + INTERVAL 2 HOUR, which give me the right time now. BUT a problem will occur some time in october, when we end summer time, and Norway will go back to UTC + 0100. Of course I...
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.