|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
||||
|
||||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > I can't believe I never learned about time & date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|