Date Time format...

lidds

Well-known member
Joined
Oct 19, 2004
Messages
122
Programming Experience
Beginner
I have a stored procedure as follows:

VB.NET:
CREATE PROCEDURE [dbo].[spQrySQLDate] 
AS
SELECT GETDATE() as SQLDate
GO

However I want to ensure that the date time format from SQL Server is in UK format i.e. dd/mm/yyyy hh:mm:ss however when I use the code below it gives me an error when trying to convert the date time returned from SQL.

VB.NET:
Dim myCmdDate As New OleDb.OleDbCommand("spQrySQLDate")
            myCmdDate.CommandType = CommandType.StoredProcedure
            myReaderDate = myDB.RunMyDataQuery(myCmdDate)

            ' Gets license validate information from database
            Dim strDate As String = Nothing
            Do While myReaderDate.Read
                strDate = (myReaderDate.Item("SQLDate"))
            Loop

            Dim strServerDateTime As String = strDate.ToString("dd/MM/yyyy hh:mm:ss")

Can anyone help???

Thanks in advance

Simon
 
Read the DW2 link in my sig, sections on using stored procedures.. The way you ahve this set up isnt quite right, i'm afraid! :/
 
Back
Top