PDA

Click to See Complete Forum and Search --> : asap please help very easy


PITBULLCJR
Jan 1st, 2000, 06:15 AM
I am stupid and I don't know how to make a variable say the date and time. Like say it is 1/1/00 7:14 pm thats what i want my variable to say. but i don't know how. I want it also to be the time as of right now. thanks

------------------
Sincerely,
Chris
:-) ;-)
Email pitbullcr7@aol.com

johnpc
Jan 1st, 2000, 06:24 AM
Put a Command Button on a Form and place the following in it's click event:

[code]Private Sub Command1_Click()
Dim MyDate As String
Dim MyStr As String
Dim MyTime As String

MyDate = Date ' Assign Today's date to a String

MyStr = Format(MyDate, " dddd, mmmm d, yyyy")
' Returns "Todays date as day of the week and
' Month of the year
' e.g. Wednesday Feb 4, 1997
' this is a VB internal function - see VB Help
' under Display Date

MyTime = Time 'Assign the current time.
'Time instead of Time$
'formats the AM or PM
'automatically

Print MyStr, MyTime

End Sub
[//code]

MartinLiss
Jan 1st, 2000, 06:24 AM
Format(Now(), "general date")

------------------
Marty