Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » Database Programming » GetDate()


GetDate()Expand / Collapse
Author
Message
Posted 2/14/2005 12:02:14 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 5/27/2008 8:32:25 PM
Posts: 56, Visits: 36

Hi,

Does anyone have an example of how to use the GetDate() function to retrieve the current date/time from an SQL server please? (VB6/SQL)

Thankyou

 



Enjoy

A

Post #8601
Posted 2/14/2005 9:30:09 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 4/21/2005 9:20:00 PM
Posts: 76, Visits: 1
hai..

try this code:
Sub TestFormatDate()
Dim cmd As New ADODB.Command, rst As New ADODB.Recordset
'init command to get the date and it's string equivalent, to compare them later
With cmd
.ActiveConnection = "Your connection string here"
.CommandText = "SELECT GetDate(), Convert(varchar,getdate(),21)"
.CommandType = adCmdText
End With
rst.Open cmd

Hope this helps

Tjhaine1100
Post #8619
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 6:43pm