?
Solved

convert date to sql server format

Posted on 2006-10-31
5
Medium Priority
?
203 Views
Last Modified: 2010-04-23
Hi

How do i convert the datte in a date or datetime object into the format required by sql server which is

yyyy-mm-dd

is there a build is function?

thanks
andrea
0
Comment
Question by:andieje
5 Comments
 
LVL 12

Accepted Solution

by:
Praveen Kumar earned 2000 total points
ID: 17841832
if i understand you correctly...

Dim d as DateTime
d=#6/25/2006#
Messagebox.Show(d.ToString("yyyy-MM-dd")

0
 

Author Comment

by:andieje
ID: 17841937
thanks for your answer. It certainly is correct. However, I'm sure once on this forum someone told me of a built in function. It may have had internation or local or something like that in the name. I shall award you the points but do you happen to know what this other function may be?

thanks
andrea
0
 
LVL 14

Expert Comment

by:shahprabal
ID: 17842006
if you are trying to convert strDate into date value, you can use cdate(strDate).ToShortDateString... you can enter date in dd/mm/yyyy format as well... sql server is not very picky
0
 
LVL 12

Expert Comment

by:Praveen Kumar
ID: 17842035
sorry, i dont remember such function name.
0
 

Expert Comment

by:phillip_chapman
ID: 17842113
You could also use the format function.

d=Microsoft.Visualbasic.Format(#6/25/2006#,"yyyy-MM-dd")

or

d=Microsoft.Visualbasic.FormatDateTime(#6/25/2006#,DateFormat.ShortDate)

This one is dependent upon the regional settings on your computer however.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question