![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I've just installed the Dreamlettes Calendar extension into DWMX2004 and I'm having a few problems with date formats. I'm using Asp with an Access database, and I'm in Australia so the date format is dd/mm/yyyy. The extension uses the US format (mm/dd/yyyy). Has anyone had/resolved the same issue - or knowes what I should do to change the code below? Thanks!! Andrea. _____________________ Function ASPCalendar If Request("EventDate") <> "" Then EventDate = DateValue(Request("EventDate")) Else EventDate = date() End if CurMonth = Month(EventDate) CurMonthName = MonthName(CurMonth) CurYear = Year(EventDate) FirstDayDate = DateSerial(CurYear, CurMonth, 1) FirstDay = WeekDay(FirstDayDate, 0) CurDay = FirstDayDate Dim tmpHTML tmpHTML="" tmpHTML = tmpHTML & "<table summary=""small_calendar"" id=""calendar"" cellspacing=""0"">" & Chr(10) tmpHTML = tmpHTML & "<caption>small_calendar</caption>" & Chr(10) tmpHTML = tmpHTML & "<tr id=""title"">" & Chr(10) tmpHTML = tmpHTML & "<th colspan=""7"">" & Chr(10) tmpHTML = tmpHTML & "<a href=""?EventDate=" & Server.URLEncode(DateAdd("m",-1, EventDate)) & """><</a>" & CurMonthName & "<a href=""?EventDate=" & Server.URLEncode(DateAdd("m",1,EventDate)) & """>></a>" tmpHTML = tmpHTML & "<a href=""?EventDate=" & Server.URLEncode(DateAdd("yyyy",-1, EventDate)) & """><</a>" & CurYear & "<a href=""?EventDate=" & Server.URLEncode(DateAdd("yyyy",1,EventDate)) & """>></a>" tmpHTML = tmpHTML & "</th>" & Chr(10) & "</tr>" & Chr(10) & "<tr id=""days"">" Response.Write(tmpHTML) For DayLoop = 1 to 7 Response.Write("<th>" & WeekDayName(Dayloop, True, 0) & "</th>" & Chr(10)) Next Response.Write("</tr>" & Chr(10) & "<tr class=""firstweek"">") If FirstDay <> 1 Then Response.Write("<td colspan=""" & (FirstDay -1) & """ class=""blank""> </td>" & Chr(10)) End if DayCounter = FirstDay CorrectMonth = True Do While CorrectMonth = True isEvent = FALSE events_cal.filter = 0 Dim iCheck Dim chkStr chkStr = (events_cal.Fields.Item("event_date").Name) iCheck = CurDay events_cal.filter = chkStr & "=" & (iCheck) If not(events_cal.EOF) Then isEvent = TRUE If CurDay = EventDate Then Response.Write("<td class=""today"">") Else Response.Write("<td class=""day" & DayCounter & """>") End if If isEvent = TRUE Then Response.Write("<a href=""events_list_date2.asp?EventDate=" & Server.URLEncode(CurDay) & """>" & Day(CurDay)& "</a>") Response.Write("</td>" & Chr(10)) Else Response.Write(Day(CurDay) & "</td>" & Chr(10)) End If DayCounter = DayCounter + 1 If DayCounter > 7 Then DayCounter = 1 Response.Write("</tr>" & Chr(10)) Response.Write("<tr") If Month(CurDay+8) <> CurMonth Then Response.Write(" class=""lastweek""") End If Response.Write(">" & Chr(10)) End if CurDay = DateAdd("d", 1, CurDay) If Month(CurDay) <> CurMonth then CorrectMonth = False End if Loop IF DayCounter <> 1 Then Response.Write("<td colspan=""" & (8-DayCounter) & """ class=""blank""> </td>") Else Response.Write("<td colspan=""7"" class=""blank""> </td>") End if Response.Write("</tr>" & Chr(10) & "</table>" & Chr(10)) End Function |
#3
| |||
| |||
|
|
Andrea, I've come across this with normal dates. Don't know if it will work with your extension, but it's worth a try. Need to set the LocaleID to tell your app you are in Australia. In the top of your file, you need to add one line of code to tell it where in the world you are. Something like: SetLocale(3081) This should make all your dates appear in native format. You could improve this by putting the localeID setting in your connections file. This means by default everything that connects to your database picks up the local setting?? More info and more local settings, try http://www.w3schools.com/vbscript/func_setlocale.asp Hope it helps, Piers "Andrea" <notvalid (AT) alphalink (DOT) com.au> wrote in message news:40e0ca25 (AT) news (DOT) alphalink.com.au... | Hello, | | I've just installed the Dreamlettes Calendar extension into DWMX2004 and I'm | having a few problems with date formats. I'm using Asp with an Access | database, and I'm in Australia so the date format is dd/mm/yyyy. The | extension uses the US format (mm/dd/yyyy). Has anyone had/resolved the same | issue - or knowes what I should do to change the code below? | Thanks!! | Andrea. | | _____________________ | | Function ASPCalendar | If Request("EventDate") <> "" Then | EventDate = DateValue(Request("EventDate")) | Else | EventDate = date() | End if | CurMonth = Month(EventDate) | CurMonthName = MonthName(CurMonth) | CurYear = Year(EventDate) | FirstDayDate = DateSerial(CurYear, CurMonth, 1) | FirstDay = WeekDay(FirstDayDate, 0) | CurDay = FirstDayDate | Dim tmpHTML | tmpHTML="" | tmpHTML = tmpHTML & "<table summary=""small_calendar"" id=""calendar"" | cellspacing=""0"">" & Chr(10) | tmpHTML = tmpHTML & "<caption>small_calendar</caption>" & Chr(10) | tmpHTML = tmpHTML & "<tr id=""title"">" & Chr(10) | tmpHTML = tmpHTML & "<th colspan=""7"">" & Chr(10) | tmpHTML = tmpHTML & "<a href=""?EventDate=" & | Server.URLEncode(DateAdd("m",-1, EventDate)) & """><</a>" & CurMonthName | & "<a href=""?EventDate=" & Server.URLEncode(DateAdd("m",1,EventDate)) & | """>></a>" | tmpHTML = tmpHTML & "<a href=""?EventDate=" & | Server.URLEncode(DateAdd("yyyy",-1, EventDate)) & """><</a>" & CurYear & | "<a href=""?EventDate=" & Server.URLEncode(DateAdd("yyyy",1,EventDate)) & | """>></a>" | tmpHTML = tmpHTML & "</th>" & Chr(10) & "</tr>" & Chr(10) & "<tr | id=""days"">" | Response.Write(tmpHTML) | For DayLoop = 1 to 7 | Response.Write("<th>" & WeekDayName(Dayloop, True, 0) & "</th>" & Chr(10)) | Next | Response.Write("</tr>" & Chr(10) & "<tr class=""firstweek"">") | If FirstDay <> 1 Then | Response.Write("<td colspan=""" & (FirstDay -1) & """ | class=""blank""> </td>" & Chr(10)) | End if | DayCounter = FirstDay | CorrectMonth = True | Do While CorrectMonth = True | isEvent = FALSE | events_cal.filter = 0 | Dim iCheck | Dim chkStr | chkStr = (events_cal.Fields.Item("event_date").Name) | iCheck = CurDay | events_cal.filter = chkStr & "=" & (iCheck) | If not(events_cal.EOF) Then isEvent = TRUE | If CurDay = EventDate Then | Response.Write("<td class=""today"">") | Else | Response.Write("<td class=""day" & DayCounter & """>") | End if | If isEvent = TRUE Then | Response.Write("<a href=""events_list_date2.asp?EventDate=" & | Server.URLEncode(CurDay) & """>" & Day(CurDay)& "</a>") | Response.Write("</td>" & Chr(10)) | Else | Response.Write(Day(CurDay) & "</td>" & Chr(10)) | End If | DayCounter = DayCounter + 1 | If DayCounter > 7 Then | DayCounter = 1 | Response.Write("</tr>" & Chr(10)) | Response.Write("<tr") | If Month(CurDay+8) <> CurMonth Then | Response.Write(" class=""lastweek""") | End If | Response.Write(">" & Chr(10)) | End if | CurDay = DateAdd("d", 1, CurDay) | If Month(CurDay) <> CurMonth then | CorrectMonth = False | End if | Loop | IF DayCounter <> 1 Then | Response.Write("<td colspan=""" & (8-DayCounter) & """ | class=""blank""> </td>") | Else | Response.Write("<td colspan=""7"" class=""blank""> </td>") | End if | Response.Write("</tr>" & Chr(10) & "</table>" & Chr(10)) | End Function | | |
#4
| |||
| |||
|
|
Thanks Piers! I've tried to set a session using the LCID ID for here, and I tried your suggestion for the locale ID. Alas, neither seems to work. I'm at a bit of a loss as to what to do - all the links return like this ?EventDate=mm/dd/yyyy . Its only with this calendar extension, the rest of my site is fine with dates in the normal format. I think it must be the code, and I don't understand enough to work it out. "Piers 2k" <piers.subscribe (AT) ntlworld (DOT) com> wrote in message news:cbr629$d6u$1 (AT) forums (DOT) macromedia.com... Andrea, I've come across this with normal dates. Don't know if it will work with your extension, but it's worth a try. Need to set the LocaleID to tell your app you are in Australia. In the top of your file, you need to add one line of code to tell it where in the world you are. Something like: SetLocale(3081) This should make all your dates appear in native format. You could improve this by putting the localeID setting in your connections file. This means by default everything that connects to your database picks up the local setting?? More info and more local settings, try http://www.w3schools.com/vbscript/func_setlocale.asp Hope it helps, Piers "Andrea" <notvalid (AT) alphalink (DOT) com.au> wrote in message news:40e0ca25 (AT) news (DOT) alphalink.com.au... | Hello, | | I've just installed the Dreamlettes Calendar extension into DWMX2004 and I'm | having a few problems with date formats. I'm using Asp with an Access | database, and I'm in Australia so the date format is dd/mm/yyyy. The | extension uses the US format (mm/dd/yyyy). Has anyone had/resolved the same | issue - or knowes what I should do to change the code below? | Thanks!! | Andrea. | | _____________________ | | Function ASPCalendar | If Request("EventDate") <> "" Then | EventDate = DateValue(Request("EventDate")) | Else | EventDate = date() | End if | CurMonth = Month(EventDate) | CurMonthName = MonthName(CurMonth) | CurYear = Year(EventDate) | FirstDayDate = DateSerial(CurYear, CurMonth, 1) | FirstDay = WeekDay(FirstDayDate, 0) | CurDay = FirstDayDate | Dim tmpHTML | tmpHTML="" | tmpHTML = tmpHTML & "<table summary=""small_calendar"" id=""calendar"" | cellspacing=""0"">" & Chr(10) | tmpHTML = tmpHTML & "<caption>small_calendar</caption>" & Chr(10) | tmpHTML = tmpHTML & "<tr id=""title"">" & Chr(10) | tmpHTML = tmpHTML & "<th colspan=""7"">" & Chr(10) | tmpHTML = tmpHTML & "<a href=""?EventDate=" & | Server.URLEncode(DateAdd("m",-1, EventDate)) & """><</a>" & CurMonthName | & "<a href=""?EventDate=" & Server.URLEncode(DateAdd("m",1,EventDate)) & | """>></a>" | tmpHTML = tmpHTML & "<a href=""?EventDate=" & | Server.URLEncode(DateAdd("yyyy",-1, EventDate)) & """><</a>" & CurYear & | "<a href=""?EventDate=" & Server.URLEncode(DateAdd("yyyy",1,EventDate)) & | """>></a>" | tmpHTML = tmpHTML & "</th>" & Chr(10) & "</tr>" & Chr(10) & "<tr | id=""days"">" | Response.Write(tmpHTML) | For DayLoop = 1 to 7 | Response.Write("<th>" & WeekDayName(Dayloop, True, 0) & "</th>" & Chr(10)) | Next | Response.Write("</tr>" & Chr(10) & "<tr class=""firstweek"">") | If FirstDay <> 1 Then | Response.Write("<td colspan=""" & (FirstDay -1) & """ | class=""blank""> </td>" & Chr(10)) | End if | DayCounter = FirstDay | CorrectMonth = True | Do While CorrectMonth = True | isEvent = FALSE | events_cal.filter = 0 | Dim iCheck | Dim chkStr | chkStr = (events_cal.Fields.Item("event_date").Name) | iCheck = CurDay | events_cal.filter = chkStr & "=" & (iCheck) | If not(events_cal.EOF) Then isEvent = TRUE | If CurDay = EventDate Then | Response.Write("<td class=""today"">") | Else | Response.Write("<td class=""day" & DayCounter & """>") | End if | If isEvent = TRUE Then | Response.Write("<a href=""events_list_date2.asp?EventDate=" & | Server.URLEncode(CurDay) & """>" & Day(CurDay)& "</a>") | Response.Write("</td>" & Chr(10)) | Else | Response.Write(Day(CurDay) & "</td>" & Chr(10)) | End If | DayCounter = DayCounter + 1 | If DayCounter > 7 Then | DayCounter = 1 | Response.Write("</tr>" & Chr(10)) | Response.Write("<tr") | If Month(CurDay+8) <> CurMonth Then | Response.Write(" class=""lastweek""") | End If | Response.Write(">" & Chr(10)) | End if | CurDay = DateAdd("d", 1, CurDay) | If Month(CurDay) <> CurMonth then | CorrectMonth = False | End if | Loop | IF DayCounter <> 1 Then | Response.Write("<td colspan=""" & (8-DayCounter) & """ | class=""blank""> </td>") | Else | Response.Write("<td colspan=""7"" class=""blank""> </td>") | End if | Response.Write("</tr>" & Chr(10) & "</table>" & Chr(10)) | End Function | | |
![]() |
| Thread Tools | |
| Display Modes | |
| |