473,387 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DateTime Value 0000:00:00 in MySQL

Hey there. I have a problem whit some date insert.

I Have 3 dropdownlists and i want the code to get the values and insert them in the database,

the code looks like this:

yyyy = Request.Form("yyyy")
mm = Request.Form("mm")
dd = Request.Form("dd")
strborn = DateSerial(yyyy,mm,dd)

Its insert everything but not the date. only get 0000:00:00.

the Datatype is set to DATETIME and its NULL

Go crazy,, need help =)
Feb 12 '08 #1
7 3023
ronverdonk
4,258 Expert 4TB
The date format in MySQL is YYYY-MM-DD.
Are you sure you have your 'date-to-be-inserted' in that format?
Otherwise show some of the code.

Ronald
Feb 13 '08 #2
"date-to-be-inserted" Hmm dont understand =). I know that the date format is YYYY-MM-DD.

What code do you want to see ? The insert code? If it so here it is:

Expand|Select|Wrap|Line Numbers
  1. objconn.execute("INSERT into konton (anvnamn, losen, epost, fornamn, efternamn, personnf, personns, hur, reggad, kon) Values ('"&request.form("anv")&"', '"&request.form("losen")&"', '"&request.form("epost")&"', '"&request.form("fornamn")&"', '"&request.form("efternamn")&"', "&strborn&", '"&request.form("perns")&"', '"&request.form("Hur")&"', CURRENT_TIMESTAMP(), '"&request.form("kon")&"')")
  2.  
Feb 13 '08 #3
mwasif
802 Expert 512MB
use single quotes around the value
Expand|Select|Wrap|Line Numbers
  1. objconn.execute("INSERT into konton (anvnamn, losen, epost, fornamn, efternamn, personnf, personns, hur, reggad, kon) Values ('"&request.form("anv")&"', '"&request.form("losen")&"', '"&request.form("epost")&"', '"&request.form("fornamn")&"', '"&request.form("efternamn")&"', '"&strborn&"', '"&request.form("perns")&"', '"&request.form("Hur")&"', CURRENT_TIMESTAMP(), '"&request.form("kon")&"')")
Feb 13 '08 #4
When i do so i get:

[MySQL][ODBC 3.51 Driver][mysqld-5.0.51a-community-nt]Incorrect datetime value: '1/1/1960' for column 'personnf' at row 1

You can see that the date is in wrong order but in the code right.

How do i fix this? if i fix it in right order do you think it will work.
Feb 13 '08 #5
Please guys really need help with this.. This is the last thing thats not working.
Feb 14 '08 #6
I did get it to work with this:

strborn = ""&request.form("yyyy")&"-"&request.form("mm")&"-"&request.form("dd")&""
Feb 16 '08 #7
ronverdonk
4,258 Expert 4TB
Thanks for sharing your solution with our members.
See you next time.

Ronald
Feb 16 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
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...
0
by: M. Bader | last post by:
Hi, i'm struggling with updating session expire times in my login table. Can you tell me, how to correctly add an amount of seconds (after that the session expires) to a datetime field? ...
0
by: David | last post by:
Hi, I have a field in a table called 'ShipDate'. This particular field has allow null set to no. So by default this sets all the records to show 00/00/0000 in the field for each record that has...
0
by: gondor | last post by:
hi! i have a problem with a update-query: start-structur (column 1 index, 2 datetime, 3 time of measurement, 4-6 values): 1 | 0000-00-00 00:00:00 | 0 | 21 | 22 | 23 2 | 0000-00-00 00:00:00...
2
by: Kenneth P | last post by:
Hi, I'm trying to use MySql 4.1 db instead of MSSql2k and am having problems with the DateTime in the db. In mysqladmtools 1.0.19 I'm recommended to use 0000-00-00 00:00:00 as the default...
12
by: Emi Lu | last post by:
Hello all, I have a question about "date" & "timestamp" types in PostgreSQL. I want to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for them. However, it seems that PostgreSQL...
7
by: Rithish | last post by:
Hello. I noticed a strange thing while using strtotime() and date() functions in combination to generate from MySQL into a readable format. By default, the MySQL date field will be 0000-00-00...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.