Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar Control.Value - Need to convert format of that date 1

Status
Not open for further replies.

tmishue

Programmer
Jun 26, 2001
35
US
Hello Out There,

Can anyone help me in converting a date such as
Mon Jan 15 00:00:00 EST 2001 to mm/dd/yyy. I have a field name StartDate with a datatype of datetime. I don't care about the time.

I am using Active X Calendar Control.value to get my date when the user click on it. Then I am querying my SQL database where StartDate = CalendarControl.Value . I can't get the query to work because the CalendarControl.Value is in the wrong format- Mon Jan 15 00:00:00 EST 2001

Any comments or suggestions would be greatly appreciated.


Thanks Much!

tammym
 
I think this will do the trick. I just displayed it in a msgbox, you can assign it to a variable or whatever

Private Sub Command2_Click()
MsgBox Format(Calendar1.Value, "mm/dd/yyyy")
End Sub
 
Thanks so much for the suggestion. I tried:
Code:
Sub DateRecordset_onbeforeopen()
clHoldate = Request("mcaltext.value")
cHoldate = Format(clHoldate, "mm/dd/yyyy")
Response.Write(cHoldate)
DateRecordset.setSQLText= "SELECT StartDate AS [Start Date], DepartmentSchool AS [Department or School], Location AS Location, StartTime AS [Start Time], EndDate AS [End Date], EndTime AS [End Time] FROM calendarinfotable WHERE (StartDate ='"&cHoldate&"') ORDERBY StartDate, DepartmentSchool, Location, StartTime, EndDate, EndTime"
End Sub
and could not get it to display mm/dd/yyyy. Got any more ideas, I'm all up for trying them out.

Thanks!
 
I just tried this for fun, Hopefully it will help ;)

I used the Microsoft calendar control 8.0 and did this...

Dim tdyDate As String
tdyDate = Calendar1.Month & "/" & Calendar1.Day & "/" & Calendar1.Year
Label1.Caption = tdyDate

my label had the format of mm/dd/yyyy....let me know if this helps ;)

While you're waiting, i'll check with the other calender controls ;)

Rob
 
Thanks Rob,

I appreciate your help so much. Your answer worked beautifully!

*:->*

tmishue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top