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
Solved

convert date to sql server format

Posted on 2006-10-31
5
190 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

765 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