hi there i am inserting a desired formated date ie
m-d-y --------2-23-2008
into mysql database in which i have the field named Bill_date which has the format Date here is my query -
$sqlAS="insert into sale_rec(Bill_no,Bill_date,Cust_name,Mop,Con_per,Con_no,Code_no,Prt_no,Stk_avl,Stk_req,U_prc,T_prc,Prd)
-
values('$billno',DATE_FORMAT('$seldate','USA'),'$cname','$mop','$cper','$cno','$codeno','$prt','$stkavl','$stkreq','$uprc','$tprc','$prd')";
-
i have swapped he statement DATE_FORMAT('$seldate','USA') to DATE_FORMAT('USA','$seldate') also but it still gives me the same error the date i am posting the date from a form and it is properly posted into this page and is showing the value in the variable $seldate
but i am recieving the following error -
Column 'Bill_date' cannot be null
-
insert into sale_rec(Bill_no,Bill_date,Cust_name,Mop,Con_per,Con_no,Code_no,Prt_no,Stk_avl,Stk_req,U_prc,T_prc,Prd) values('1007',DATE_FORMAT('02-23-2008','USA'),'sameeer','CHEQUE','oemr','0321','1000','CSV-4456','13','1','500','500','WATER_FILTER')
-
4 4523
DATE_FORMAT() does not have the 'USA' attribute. That option is used in function GET_FORMAT().
You'll have to use - INSERT ........ STR_TO_DATE('$seldate', '%d-%m-%Y');
Ronald
mwasif 802
Recognized Expert Contributor
You can not insert date in m-d-y format. DATE only accepts yyyy-mm-dd. But you can use DATE_FORMAT() and other date functions to get the desired output.
You can not insert date in m-d-y format. DATE only accepts yyyy-mm-dd. But you can use DATE_FORMAT() and other date functions to get the desired output.
thnaks alot buddies i knew that it wont be possble but as searching to do so cbecause i am a new beee to mysql and php used to work in access and asp before.
You are welcome. See you next time around.
Ronald
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: seash |
last post by:
H
when i execute this query, my query is crashing throwing an exception "cant convert char datatype to datetime type format
my query is "insert into mytable(mydate) values ('"+ varmydate+ "')...
|
by: Miguel Dias Moura |
last post by:
Hello,
i am just finishing a web site in ASP.net / VB using Dreamweaver MX 2004 and
in all the pages i use the date/time format as follows:
Date: DD-MM-YYYY
Time: HH-MM (24 hours)
Anyway,...
|
by: Arek |
last post by:
Hey,
I am inserting values in the table:
Dim sqlcomm1 As SqlCommand = New SqlCommand("INSERT INTO tblTasks
(idTask, outdate) VALUES ('" & IDTask.text & "','" & txtOutdate.Text &
"')", conn)...
|
by: Takeadoe |
last post by:
Gang -
I'm generating date and time variables from scanned forms. Currently,
the date and time values are as follows: 06/26/2006 and 11:30 AM. I've
written VBA code to combine them into a...
|
by: shubhra |
last post by:
I am taking the date in format DD-MM-YYYY from a popup calendar in the text box in a Jsp. And i need to insert that date in to the database.
But my problem is when i am printing the date in webpage...
| |
by: Curious |
last post by:
Hi,
I have a column in a grid defined as DateTime type.
Currently, it's displayed in the format of "5/23/2007", for an
example. It seems that it's using the default "short date" format.
I...
|
by: yzlin04 |
last post by:
Does anyone know how to insert date into vb.net datagrid by using INSERT INTO command?
From the code below, the error message is in cmd.ExecuteNonQuery() line.
Here is the error message:
An...
|
by: |
last post by:
Hi,
I program in asp.net. I have a date in TextBox in format "dd/MM/yyyy".
I would like to validate if the date is realy correct.
I used RegularExpressionValidator with...
|
by: ahmurad |
last post by:
Dear Brothers,
I am struggling the following four Date-Time type values which were inputted into MYSQL database in different tables. As
MYSQL Default Time Format: YYYY-MM-DD HH:MM:SS, So I used...
|
by: ankitjain100 |
last post by:
Hello Guys,
This is my first question on this platform.
I want to ask that How to insert Date in MY SQL in the MM-DD-YY format i am using JSP as my frontend.
Please tell me , i will be very...
|
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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |