Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

convert date to sql server format

Posted on 2006-10-31
5
Medium Priority
?
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

636 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