# C1.Win.Schedule.C1Schedule.BeforeTimeFormat

## Content

<div class="doc-site-dotnet-api-container">




<h1 id="C1_Win_Schedule_C1Schedule_BeforeTimeFormat" data-uid="C1.Win.Schedule.C1Schedule.BeforeTimeFormat" class="text-break">BeforeTimeFormat Event
</h1>
<div class="markdown level0 summary"><p>Occurs before the time interval is formatted.</p>
</div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>: <a class="xref" href="C1.Win.Schedule.html">C1.Win.Schedule</a></h6>
<h6><strong>Assembly</strong>: C1.Win.Schedule.10.dll</h6>
<h5 id="C1_Win_Schedule_C1Schedule_BeforeTimeFormat_syntax">Syntax</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[C1Description(&quot;BeforeTimeFormat&quot;, &quot;Fired before the time interval is formatted.&quot;)]
[C1Category(&quot;UI&quot;)]
public event EventHandler&lt;BeforeTimeFormatEventArgs&gt; BeforeTimeFormat</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;C1Description(&quot;BeforeTimeFormat&quot;, &quot;Fired before the time interval is formatted.&quot;)&gt;
&lt;C1Category(&quot;UI&quot;)&gt;
Public Event BeforeTimeFormat As EventHandler(Of BeforeTimeFormatEventArgs)</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.eventhandler-1">EventHandler</a>&lt;<a class="xref" href="C1.Win.Schedule.BeforeTimeFormatEventArgs.html">BeforeTimeFormatEventArgs</a>&gt;</td>
      <td>Occurs before the time interval is formatted.</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_Schedule_C1Schedule_BeforeTimeFormat_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>Use this event to alter default time interval appearance.
For example, to display different working hours for different days.</p>
</div>
<h5 id="C1_Win_Schedule_C1Schedule_BeforeTimeFormat_examples"><strong>Examples</strong></h5>
<p>This sample shows how to alter time interval appearance depending on <a class="xref" href="C1.Win.Schedule.BeforeTimeFormatEventArgs.html">BeforeTimeFormatEventArgs</a> properties.
<pre><code class="lang-csharp">private void c1Schedule1_BeforeTimeFormat(object sender, BeforeTimeFormatEventArgs e)
{
if (e.Start.TimeOfDay == TimeSpan.FromMinutes(120))
{
e.WorkTime = true;
if (e.Start.DayOfWeek == DayOfWeek.Sunday)
{
e.Background = Color.Red;
}
}
else if (e.Start.TimeOfDay == TimeSpan.FromMinutes(240) &amp;&amp;  e.Start.DayOfWeek != DayOfWeek.Sunday)
{
e.Background = c1Schedule1.Theme.Palette.FreeHourBorder;
}
else
{
if (e.Start.DayOfWeek == DayOfWeek.Sunday &amp;&amp; e.Duration.TotalDays == 1)
{
e.Background = Color.Navy;
}
}
}</code></pre>

</div>
