Solved

convert date to sql server format

Posted on 2006-10-31
5
183 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:
Mamtha1982 earned 500 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:Mamtha1982
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now