Hi,

I am trying to set on my intranet website an online event calendar using ASP.NET vb.net and an access 2000 database.

Everything is working nicely since I can add new events,display and update them no problem.

The only problem is that when displayed on the calendar, all the

" event starting time" come in this format : 06/29/2005 7:30 Am

when I only want the time to display on the 7:30 AM like format.Please help !

You can find below my code :
VB Code:
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
  3. <%@ Import Namespace="System.Data" %>
  4. <%@ Import Namespace="System.Data.OleDb" %>
  5. <script runat="server">
  6.  
  7. Dim ds As New DataSet()
  8.  
  9. Protected Sub Page_Load(Src As [Object], E As EventArgs)
  10.    'Note: The following two lines of code should be on the same line.
  11.    Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("aspnet_calendar.mdb") + ";"
  12.    Dim sql As String = "select * from events"
  13.    
  14.    'Create a DataAdapter
  15.    Dim da As New OleDbDataAdapter(sql, connectionstring)
  16.    
  17.    'Fill the DataSet (ds)
  18.  
  19.    da.Fill(ds, "events")
  20. End Sub
  21.  
  22. Protected Sub eventscalendar_DayRender(Src As [Object], E As DayRenderEventArgs)
  23.    'use a StringBuilder object for optimized string concatenation
  24.    Dim strEvents As New StringBuilder()
  25.    strEvents.Append("<span style=""font-size:80%"">")
  26.    
  27.    Dim row As DataRow
  28.    For Each row In  ds.Tables("events").Rows
  29.       Dim eventdate As DateTime = CType(row("eventdate"), DateTime)
  30.       If eventdate.Equals(E.Day.Date) Then
  31.          
  32.          strEvents.Append(("<br />" + row("eventtext") + "<br />" + row("startingtime")))
  33.       End If
  34.    Next row
  35.    'Close off the string in the strEvents StringBuilder
  36.    strEvents.Append("</span>")
  37.    
  38.    'Add the string to the cell in a LiteralControl
  39.    E.Cell.Controls.Add(New LiteralControl(strEvents.ToString()))
  40. End Sub 'eventscalendar_DayRender
  41.  
  42. </script>
  43.  
  44. <html>
  45. <head>
  46. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  47. <title>Untitled Document</title>
  48. </head>
  49. <body>
  50. <form runat="server">
  51. <asp:calendar BackColor="#FFFFCC" DayHeaderStyle-BackColor="#FFFFFF" DayStyle-HorizontalAlign="right" Font-Size="16" Height="100%" ID="eventcalendar" NextPrevStyle-BackColor="#99FFCC" runat="server" ShowDayHeader="true" ShowGridLines="true" ShowNextPrevMonth="true" TitleFormat="MonthYear" TitleStyle-ForeColor="#0000FF" WeekendDayStyle-BackColor="#FFCCFF" Width="100%"
  52.   OnDayRender="eventscalendar_DayRender" align="center"></asp:calendar>
  53. </form >
  54.  
  55. </div>
  56. </body>
  57. </html>