ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 15th, 2005, 08:18 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
I can't believe I never learned about time & date

How can i make it show the date and stuff when certain events happen..

I know the 'general idea'.. but need help :$

If i have a form submitting to database, do i have the value as now() or the field in the database as defaulted as now() ??

Then...

I am using MySQL but i have a front program..

I want the date and time so I set the field as "DateTime"

When i submit it - it just shows up in my database as '0000-00-00 00:00:00'

Also I have another question, the date on my server is not correct.. is there a way i can get the correct date without changing my calendar?

Reply With Quote
  #2  
Old January 16th, 2005, 06:47 AM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,580 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 6 Days 5 h 13 m 34 sec
Reputation Power: 949
wow, so many questions

which one would you like to have answered?

ordinarily, you would set the DEFAULT value of a column to be the current datetime, and then, when inserting a row, don't mention that column, and it will automatically be assigned the datetime of the insert

however, mysql does not support the use of a function as a DEFAULT

so this means you should mention the column in the insert, except give it a value using the database's current datetime function

e.g. INSERT INTO t (..., datetimecol, ...) VALUES (..., current_timestamp, ...)

on the other hand, mysql has this neat feature where the first TIMESTAMP column in a table is automatically maintained for every insert and update operation on the row, so you could use that instead

with regard you all your date values showing up as 0000-00-00, this is probably because you are not entering them in the correct year-month-day sequence

i'm not gonna touch the question of the server clock being wrong
__________________
r937.com | rudy.ca

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > I can't believe I never learned about time & date


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway