ASP Question

  • Thread starter Thread starter Guest
  • Start date Start date
¤ how to do i conver "FormatDateTime(Date, 2)" to sql format which is yyyy55dd
¤ with ASP ?

You don't need to be concerned with date formats if you pass the date as a date parameter (not
string or character) value in a stored procedure.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Interesting. There is no SQL Server date format of "yyyy55dd" (Not sure
what the 5's are, except by process of elimination, they'd be the month
digits. Since there isn't a two-letter abbreviation for the months, we
normally write "yyyyMMdd". The reason to capitalize the MM is because mm is
used for minutes).

If you have a date in datetime format in .Net, and you need to store it as a
STRING that is formatted in the manner above, then you can do so using the
following code:

(VB.Net)
Dim rightNow as DateTime = DateTime.Now
Dim s as String 'create a string

s = rightNow.ToString("yyyyMMdd")

Documentation on the date-time formatting characters can be found here.
http://msdn.microsoft.com/library/e...globalizationdatetimeformatinfoclasstopic.asp

A helpful article on date time conversion can be found here
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=181

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
Back
Top