473,385 Members | 1,942 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,385 software developers and data experts.

changing date format in update statement

jt
I posted this yesterday, but I am not seeing this out yet:

I am having problems with updating a date field in a certain format.
The data is stored in an Oracle database. The date is automatically
displayed in format, "mm/dd/yyyy" on the ASP page, but it is accepted
only in another format, "dd/mon/yy". I want to make it consistent.
How can I force it to accept the date in format "mm/dd/yyyy"? The
second option would be to force it to display in "dd/mon/yy". Here's
my current update SQL statement:

commUpdate.CommandText = "UPDATE table1 SET DatePaid = '" +
varDatePaid +
"' WHERE ID = " + varRecID

thanks,
jt
Jul 19 '05 #1
1 60872
Oracle stores date in generalized format, you can display in many
different formats . For that you can use to_char sql function.
like

to_char(Date_in_database, 'MM-DD-YYYY HH24:MI:SS');

Similarly you convert the Date in character format to Date format
using to Date function
To_date('12-12-1999','MM-dd-YYYY');

in your case trying to update the date field in oracle you could try
some thing like this
update table1 set datepaid = to_date('12/12/1999','MM/DD/YYYY')

Since ASP variables display date in character format and their
data-type is character so you need to convert it to date datatype
using to_date function.

Hope it helps!

Faheem
ju**********@yahoo.com (jt) wrote in message news:<6f**************************@posting.google. com>...
I posted this yesterday, but I am not seeing this out yet:

I am having problems with updating a date field in a certain format.
The data is stored in an Oracle database. The date is automatically
displayed in format, "mm/dd/yyyy" on the ASP page, but it is accepted
only in another format, "dd/mon/yy". I want to make it consistent.
How can I force it to accept the date in format "mm/dd/yyyy"? The
second option would be to force it to display in "dd/mon/yy". Here's
my current update SQL statement:

commUpdate.CommandText = "UPDATE table1 SET DatePaid = '" +
varDatePaid +
"' WHERE ID = " + varRecID

thanks,
jt

Jul 19 '05 #2

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

Similar topics

5
by: S.Patten | last post by:
Hi, I have a problem with updating a datetime column, When I try to change the Column from VB I get "Incorrect syntax near '942'" returned from '942' is the unique key column value ...
2
by: Chris | last post by:
Hello, i'm using a form with 2 dates in the format mm/dd/yyyy in it. I wanna calculate the days between the two dates. I tried it like this: <script language="JavaScript"> var date1 = new...
1
by: Gani Pola | last post by:
Can someone please tell me how I can change the date format (e.g dd/mm/yyyy, mm/dd/yyyy) in a configuration file? In my windows app, I can retrieve the windows setting but not my ASP.NET...
5
by: Terry Olsen | last post by:
I have a function that returns the date in the following format: 6/22/2005 I need the format to be: 050622 I have zero experience with RegEx but I believe that would be the way to go...
8
by: frenzic | last post by:
Hi I am a DBA - just been in the job two weeks and I would be grateful for some help. I am trying to update a table with values from another table. I have spent two days on this and I think...
5
mgpsivan
by: mgpsivan | last post by:
Hi, i have form in Asp.net(2003) in that i've to change the format of the date by the following statement Format(Date.Today, "dd/mm/yyyy") but when i give this code the month part displays as...
15
by: cephal0n | last post by:
I have a technical Date problem that's really difficult for me, I have a "custom made" Date format MM.DD.YY this is actually extracted from SAP and theirs no other format option offered such as...
1
by: jt | last post by:
I posted this yesterday, but I am not seeing this out yet: I am having problems with updating a date field in a certain format. The data is stored in an Oracle database. The date is...
2
by: deathal | last post by:
Hi I'm trying to make a list of dates between two dates and i found this http://bytes.com/forum/thread774887.html and used the code at the bottom to make the list but i need the list to output...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.