vb6parse 1.0.1

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="VB6Parse Library Reference - timeserial - Datetime">
    <title>timeserial - Datetime - VB6Parse Library Reference</title>
    <link rel="stylesheet" href="../../../assets/css/style.css">
    <link rel="stylesheet" href="../../../assets/css/docs-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
    <script src="../../../assets/js/theme-switcher.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
    <script>hljs.highlightAll();</script>
</head>
<body>
    <header class="docs-header">
        <div class="container">
            <h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/functions/datetime/index.html">Datetime</a> / timeserial</h1>
            <p class="tagline">VB6 Library Reference</p>
        </div>
    </header>

    <nav class="docs-nav">
        <div class="container">
            <a href="../../../index.html">Home</a>
            <a href="../../../library/index.html">Library Reference</a>
            <a href="../../../documentation.html">Documentation</a>
            <a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
            <a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
            <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
                <span class="theme-icon">🌙</span>
            </button>
        </div>
    </nav>

    <main class="container">
        
        <article class="library-item">
            <p>VB6 TimeSerial Function
The <code>TimeSerial</code> function returns a Variant (Date) containing the time for a specific hour, minute, and second.</p>
<h2 id="syntax">Syntax</h2>
<pre><code class="language-vbnet">TimeSerial(hour, minute, second)</code></pre>
<h2 id="parameters">Parameters</h2>
<ul>
<li><code>hour</code>: Required. Integer from 0 to 23, representing the hour. Values outside this range are normalized.</li>
<li><code>minute</code>: Required. Integer representing the minute. Values outside 0-59 are normalized.</li>
<li><code>second</code>: Required. Integer representing the second. Values outside 0-59 are normalized.</li>
</ul>
<h2 id="returns">Returns</h2>
<p>Returns a <code>Variant</code> of subtype <code>Date</code> containing a time value. The date portion is set to zero (December 30, 1899).</p>
<h2 id="remarks">Remarks</h2>
<p>The <code>TimeSerial</code> function creates time values from component parts:
- <strong>24-hour format</strong>: Hour parameter uses 24-hour format (0-23)
- <strong>Normalization</strong>: Values outside normal ranges are automatically adjusted
- <strong>Date portion</strong>: Always returns zero date (12/30/1899)
- <strong>Overflow handling</strong>: Excess values roll over (e.g., 90 seconds = 1 minute 30 seconds)
- <strong>Negative values</strong>: Can use negative values to subtract time
- <strong>Calculation flexibility</strong>: Can use expressions for any parameter
- <strong>Time arithmetic</strong>: Ideal for adding/subtracting time intervals
- <strong>Companion to <code>DateSerial</code></strong>: <code>TimeSerial</code> for time, <code>DateSerial</code> for dates
- <strong>Type returned</strong>: Returns Variant (Date), not a numeric type</p>
<h3 id="normalization-examples">Normalization Examples</h3>
<pre><code class="language-vbnet">&#x27; These all produce valid times through normalization:
TimeSerial(0, 0, 90)      &#x27; = 00:01:30 (90 seconds = 1 min 30 sec)
TimeSerial(0, 90, 0)      &#x27; = 01:30:00 (90 minutes = 1 hour 30 min)
TimeSerial(25, 0, 0)      &#x27; = 01:00:00 (25 hours = 1 AM next day)
TimeSerial(0, -30, 0)     &#x27; = 23:30:00 (previous day)
TimeSerial(12, 30, -60)   &#x27; = 12:29:00 (subtract 60 seconds)</code></pre>
<h3 id="time-arithmetic">Time Arithmetic</h3>
<pre><code class="language-vbnet">&#x27; Add 2 hours to current time
newTime = Time + TimeSerial(2, 0, 0)
&#x27; Subtract 30 minutes
newTime = Time + TimeSerial(0, -30, 0)
&#x27; Add 1 hour 15 minutes
newTime = Time + TimeSerial(1, 15, 0)</code></pre>
<h3 id="creating-specific-times">Creating Specific Times</h3>
<pre><code class="language-vbnet">&#x27; 8:30 AM
morning = TimeSerial(8, 30, 0)
&#x27; Noon
noon = TimeSerial(12, 0, 0)
&#x27; 11:59:59 PM
lastSecond = TimeSerial(23, 59, 59)
&#x27; Midnight
midnight = TimeSerial(0, 0, 0)</code></pre>
<h2 id="typical-uses">Typical Uses</h2>
<ol>
<li><strong>Create Time Values</strong>: Build time from components</li>
<li><strong>Time Arithmetic</strong>: Add/subtract hours, minutes, seconds</li>
<li><strong>Schedule Times</strong>: Define specific times for scheduling</li>
<li><strong>Time Comparison</strong>: Create reference times for comparison</li>
<li><strong>Time Calculations</strong>: Calculate time differences</li>
<li><strong>Business Hours</strong>: Define opening/closing times</li>
<li><strong>Time Intervals</strong>: Represent durations</li>
<li><strong>Alarm Times</strong>: Set specific alarm or reminder times</li>
</ol>
<h2 id="basic-examples">Basic Examples</h2>
<h3 id="example-1-create-specific-time">Example 1: Create Specific Time</h3>
<pre><code class="language-vbnet">Sub CreateTime()
    Dim businessOpen As Date
    businessOpen = TimeSerial(9, 0, 0)  &#x27; 9:00 AM
    MsgBox &quot;Opens at: &quot; &amp; Format$(businessOpen, &quot;hh:mm AM/PM&quot;)
End Sub</code></pre>
<h3 id="example-2-add-time-to-current-time">Example 2: Add Time to Current Time</h3>
<pre><code class="language-vbnet">Function AddHours(hours As Integer) As Date
    AddHours = Time + TimeSerial(hours, 0, 0)
End Function</code></pre>
<h3 id="example-3-calculate-time-difference">Example 3: Calculate Time Difference</h3>
<pre><code class="language-vbnet">Function GetTimeDuration(hours As Integer, minutes As Integer) As Date
    GetTimeDuration = TimeSerial(hours, minutes, 0)
End Function</code></pre>
<h3 id="example-4-check-if-time-is-between-range">Example 4: Check If Time Is Between Range</h3>
<pre><code class="language-vbnet">Function IsInTimeRange(checkTime As Date, startHour As Integer, endHour As Integer) As Boolean
    Dim startTime As Date
    Dim endTime As Date
    startTime = TimeSerial(startHour, 0, 0)
    endTime = TimeSerial(endHour, 0, 0)
    IsInTimeRange = (checkTime &gt;= startTime And checkTime &lt; endTime)
End Function</code></pre>
<h2 id="common-patterns">Common Patterns</h2>
<h3 id="pattern-1-add-minutes-to-time">Pattern 1: Add Minutes to Time</h3>
<pre><code class="language-vbnet">Function AddMinutes(baseTime As Date, minutes As Integer) As Date
    AddMinutes = baseTime + TimeSerial(0, minutes, 0)
End Function</code></pre>
<h3 id="pattern-2-add-seconds-to-time">Pattern 2: Add Seconds to Time</h3>
<pre><code class="language-vbnet">Function AddSeconds(baseTime As Date, seconds As Integer) As Date
    AddSeconds = baseTime + TimeSerial(0, 0, seconds)
End Function</code></pre>
<h3 id="pattern-3-create-time-from-total-seconds">Pattern 3: Create Time from Total Seconds</h3>
<pre><code class="language-vbnet">Function SecondsToTime(totalSeconds As Long) As Date
    Dim hours As Long
    Dim minutes As Long
    Dim seconds As Long
    hours = totalSeconds \ 3600
    minutes = (totalSeconds Mod 3600) \ 60
    seconds = totalSeconds Mod 60
    SecondsToTime = TimeSerial(hours, minutes, seconds)
End Function</code></pre>
<h3 id="pattern-4-round-time-to-nearest-interval">Pattern 4: Round Time to Nearest Interval</h3>
<pre><code class="language-vbnet">Function RoundToNearestMinutes(t As Date, intervalMinutes As Integer) As Date
    Dim totalMinutes As Long
    Dim roundedMinutes As Long
    totalMinutes = Hour(t) * 60 + Minute(t)
    roundedMinutes = ((totalMinutes + intervalMinutes \ 2) \ intervalMinutes) * intervalMinutes
    RoundToNearestMinutes = TimeSerial(roundedMinutes \ 60, roundedMinutes Mod 60, 0)
End Function</code></pre>
<h3 id="pattern-5-calculate-elapsed-time">Pattern 5: Calculate Elapsed Time</h3>
<pre><code class="language-vbnet">Function CalculateElapsedTime(startTime As Date, endTime As Date) As Date
    Dim diffSeconds As Long
    diffSeconds = DateDiff(&quot;s&quot;, startTime, endTime)
    CalculateElapsedTime = TimeSerial(0, 0, diffSeconds)
End Function</code></pre>
<h3 id="pattern-6-get-noon-time">Pattern 6: Get Noon Time</h3>
<pre><code class="language-vbnet">Function GetNoon() As Date
    GetNoon = TimeSerial(12, 0, 0)
End Function</code></pre>
<h3 id="pattern-7-get-midnight-time">Pattern 7: Get Midnight Time</h3>
<pre><code class="language-vbnet">Function GetMidnight() As Date
    GetMidnight = TimeSerial(0, 0, 0)
End Function</code></pre>
<h3 id="pattern-8-create-business-hours-range">Pattern 8: Create Business Hours Range</h3>
<pre><code class="language-vbnet">Sub GetBusinessHours(ByRef openTime As Date, ByRef closeTime As Date)
    openTime = TimeSerial(9, 0, 0)    &#x27; 9 AM
    closeTime = TimeSerial(17, 0, 0)  &#x27; 5 PM
End Sub</code></pre>
<h3 id="pattern-9-add-time-duration">Pattern 9: Add Time Duration</h3>
<pre><code class="language-vbnet">Function AddDuration(baseTime As Date, hours As Integer, minutes As Integer, seconds As Integer) As Date
    AddDuration = baseTime + TimeSerial(hours, minutes, seconds)
End Function</code></pre>
<h3 id="pattern-10-normalize-time-components">Pattern 10: Normalize Time Components</h3>
<pre><code class="language-vbnet">Function NormalizeTime(hours As Integer, minutes As Integer, seconds As Integer) As Date
    NormalizeTime = TimeSerial(hours, minutes, seconds)
End Function</code></pre>
<h2 id="advanced-usage">Advanced Usage</h2>
<h3 id="example-1-time-calculator-class">Example 1: Time Calculator Class</h3>
<pre><code class="language-vbnet">&#x27; Class: TimeCalculator
&#x27; Performs various time calculations and manipulations
Option Explicit
Public Function AddTime(baseTime As Date, hours As Integer, minutes As Integer, seconds As Integer) As Date
    AddTime = baseTime + TimeSerial(hours, minutes, seconds)
End Function
Public Function SubtractTime(baseTime As Date, hours As Integer, minutes As Integer, seconds As Integer) As Date
    SubtractTime = baseTime + TimeSerial(-hours, -minutes, -seconds)
End Function
Public Function GetTimeBetween(startTime As Date, endTime As Date) As Date
    Dim diffSeconds As Long
    Dim hours As Long
    Dim minutes As Long
    Dim seconds As Long
    diffSeconds = DateDiff(&quot;s&quot;, startTime, endTime)
    hours = diffSeconds \ 3600
    minutes = (diffSeconds Mod 3600) \ 60
    seconds = diffSeconds Mod 60
    GetTimeBetween = TimeSerial(hours, minutes, seconds)
End Function
Public Function RoundToQuarterHour(t As Date) As Date
    Dim totalMinutes As Long
    Dim roundedMinutes As Long
    totalMinutes = Hour(t) * 60 + Minute(t)
    roundedMinutes = ((totalMinutes + 7) \ 15) * 15
    RoundToQuarterHour = TimeSerial(roundedMinutes \ 60, roundedMinutes Mod 60, 0)
End Function
Public Function TruncateToMinute(t As Date) As Date
    TruncateToMinute = TimeSerial(Hour(t), Minute(t), 0)
End Function
Public Function TruncateToHour(t As Date) As Date
    TruncateToHour = TimeSerial(Hour(t), 0, 0)
End Function
Public Function CreateTimeFromSeconds(totalSeconds As Long) As Date
    CreateTimeFromSeconds = TimeSerial(0, 0, totalSeconds)
End Function
Public Function CreateTimeFromMinutes(totalMinutes As Long) As Date
    CreateTimeFromMinutes = TimeSerial(0, totalMinutes, 0)
End Function</code></pre>
<h3 id="example-2-schedule-manager-module">Example 2: Schedule Manager Module</h3>
<pre><code class="language-vbnet">&#x27; Module: ScheduleManager
&#x27; Manages schedules and time-based operations
Option Explicit
Private Type ScheduleEntry
    Name As String
    StartTime As Date
    EndTime As Date
    Active As Boolean
End Type
Private m_Schedules() As ScheduleEntry
Private m_ScheduleCount As Long
Public Sub AddSchedule(name As String, startHour As Integer, startMinute As Integer, _
                      endHour As Integer, endMinute As Integer)
    ReDim Preserve m_Schedules(m_ScheduleCount)
    m_Schedules(m_ScheduleCount).Name = name
    m_Schedules(m_ScheduleCount).StartTime = TimeSerial(startHour, startMinute, 0)
    m_Schedules(m_ScheduleCount).EndTime = TimeSerial(endHour, endMinute, 0)
    m_Schedules(m_ScheduleCount).Active = True
    m_ScheduleCount = m_ScheduleCount + 1
End Sub
Public Function IsScheduleActive(name As String) As Boolean
    Dim i As Long
    Dim currentTime As Date
    currentTime = Time
    For i = 0 To m_ScheduleCount - 1
        If m_Schedules(i).Name = name And m_Schedules(i).Active Then
            If m_Schedules(i).StartTime &lt;= m_Schedules(i).EndTime Then
                &#x27; Normal schedule (same day)
                IsScheduleActive = (currentTime &gt;= m_Schedules(i).StartTime And _
                                  currentTime &lt; m_Schedules(i).EndTime)
            Else
                &#x27; Overnight schedule
                IsScheduleActive = (currentTime &gt;= m_Schedules(i).StartTime Or _
                                  currentTime &lt; m_Schedules(i).EndTime)
            End If
            Exit Function
        End If
    Next i
    IsScheduleActive = False
End Function
Public Function GetScheduleDuration(name As String) As Date
    Dim i As Long
    Dim diffSeconds As Long
    For i = 0 To m_ScheduleCount - 1
        If m_Schedules(i).Name = name Then
            diffSeconds = DateDiff(&quot;s&quot;, m_Schedules(i).StartTime, m_Schedules(i).EndTime)
            If diffSeconds &lt; 0 Then diffSeconds = diffSeconds + 86400  &#x27; Add 24 hours
            GetScheduleDuration = TimeSerial(0, 0, diffSeconds)
            Exit Function
        End If
    Next i
    GetScheduleDuration = TimeSerial(0, 0, 0)
End Function</code></pre>
<h3 id="example-3-time-range-validator-class">Example 3: Time Range Validator Class</h3>
<pre><code class="language-vbnet">&#x27; Class: TimeRangeValidator
&#x27; Validates times against allowed ranges
Option Explicit
Private m_AllowedStart As Date
Private m_AllowedEnd As Date
Private m_AllowOvernight As Boolean
Public Sub SetAllowedRange(startHour As Integer, startMinute As Integer, _
                          endHour As Integer, endMinute As Integer)
    m_AllowedStart = TimeSerial(startHour, startMinute, 0)
    m_AllowedEnd = TimeSerial(endHour, endMinute, 0)
    m_AllowOvernight = (m_AllowedStart &gt; m_AllowedEnd)
End Sub
Public Function IsTimeAllowed(checkTime As Date) As Boolean
    If m_AllowOvernight Then
        &#x27; Overnight range (e.g., 10 PM to 6 AM)
        IsTimeAllowed = (checkTime &gt;= m_AllowedStart Or checkTime &lt; m_AllowedEnd)
    Else
        &#x27; Normal range (e.g., 9 AM to 5 PM)
        IsTimeAllowed = (checkTime &gt;= m_AllowedStart And checkTime &lt; m_AllowedEnd)
    End If
End Function
Public Function GetNextAllowedTime(fromTime As Date) As Date
    If IsTimeAllowed(fromTime) Then
        GetNextAllowedTime = fromTime
    Else
        &#x27; Return start of next allowed window
        If fromTime &lt; m_AllowedStart Then
            GetNextAllowedTime = m_AllowedStart
        Else
            &#x27; Must wait until tomorrow&#x27;s start time
            GetNextAllowedTime = DateAdd(&quot;d&quot;, 1, Date) + m_AllowedStart
        End If
    End If
End Function
Public Function GetTimeUntilAllowed(fromTime As Date) As Date
    Dim nextAllowed As Date
    Dim diffSeconds As Long
    nextAllowed = GetNextAllowedTime(fromTime)
    diffSeconds = DateDiff(&quot;s&quot;, fromTime, nextAllowed)
    GetTimeUntilAllowed = TimeSerial(0, 0, diffSeconds)
End Function</code></pre>
<h3 id="example-4-time-interval-generator-module">Example 4: Time Interval Generator Module</h3>
<pre><code class="language-vbnet">&#x27; Module: TimeIntervalGenerator
&#x27; Generates time intervals for scheduling
Option Explicit
Public Function GenerateTimeIntervals(startHour As Integer, endHour As Integer, _
                                     intervalMinutes As Integer) As Collection
    Dim intervals As New Collection
    Dim currentTime As Date
    Dim endTime As Date
    currentTime = TimeSerial(startHour, 0, 0)
    endTime = TimeSerial(endHour, 0, 0)
    Do While currentTime &lt; endTime
        intervals.Add currentTime
        currentTime = currentTime + TimeSerial(0, intervalMinutes, 0)
    Loop
    Set GenerateTimeIntervals = intervals
End Function
Public Function GenerateWorkDaySchedule(startHour As Integer, endHour As Integer, _
                                       taskDurationMinutes As Integer) As Variant
    Dim schedule() As Date
    Dim currentTime As Date
    Dim endTime As Date
    Dim index As Long
    Dim maxSlots As Long
    currentTime = TimeSerial(startHour, 0, 0)
    endTime = TimeSerial(endHour, 0, 0)
    maxSlots = DateDiff(&quot;n&quot;, currentTime, endTime) \ taskDurationMinutes
    ReDim schedule(maxSlots - 1)
    index = 0
    Do While currentTime &lt; endTime And index &lt; maxSlots
        schedule(index) = currentTime
        currentTime = currentTime + TimeSerial(0, taskDurationMinutes, 0)
        index = index + 1
    Loop
    GenerateWorkDaySchedule = schedule
End Function
Public Function CreateAppointmentSlots(startHour As Integer, endHour As Integer, _
                                      slotDuration As Integer, breakDuration As Integer) As Collection
    Dim slots As New Collection
    Dim currentTime As Date
    Dim endTime As Date
    currentTime = TimeSerial(startHour, 0, 0)
    endTime = TimeSerial(endHour, 0, 0)
    Do While currentTime + TimeSerial(0, slotDuration, 0) &lt;= endTime
        slots.Add currentTime
        currentTime = currentTime + TimeSerial(0, slotDuration + breakDuration, 0)
    Loop
    Set CreateAppointmentSlots = slots
End Function</code></pre>
<h2 id="error-handling">Error Handling</h2>
<p>The <code>TimeSerial</code> function can raise the following errors:
- <strong>Error 5 (Invalid procedure call)</strong>: If parameters result in invalid time after normalization
- <strong>Error 13 (Type mismatch)</strong>: If non-numeric arguments provided
- <strong>Error 6 (Overflow)</strong>: If extreme values cause numeric overflow</p>
<h2 id="performance-notes">Performance Notes</h2>
<ul>
<li>Fast operation - simple calculation</li>
<li>Constant time O(1) complexity</li>
<li>No significant overhead from normalization</li>
<li>Efficient for time arithmetic</li>
<li>Safe to call repeatedly</li>
</ul>
<h2 id="best-practices">Best Practices</h2>
<ol>
<li><strong>Use for time creation</strong> rather than parsing strings</li>
<li><strong>Leverage normalization</strong> for time arithmetic (e.g., negative minutes to subtract)</li>
<li><strong>Store as Date type</strong> for compatibility with other date/time functions</li>
<li><strong>Use 24-hour format</strong> for hour parameter (0-23)</li>
<li><strong>Combine with Date</strong> for complete date/time values</li>
<li><strong>Use for relative times</strong> (intervals, durations)</li>
<li><strong>Format for display</strong> with Format$ function</li>
<li><strong>Document time assumptions</strong> (e.g., time zone, 24-hour format)</li>
<li><strong>Validate inputs</strong> if accepting user-provided values</li>
<li><strong>Use <code>DateAdd</code></strong> for more complex date/time arithmetic</li>
</ol>
<h2 id="comparison-table">Comparison Table</h2>
<table>
<thead>
<tr>
<th>Function</th>
<th>Purpose</th>
<th>Parameters</th>
<th>Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>TimeSerial</code></td>
<td>Create time from components</td>
<td>hour, minute, second</td>
<td>Date (time only)</td>
</tr>
<tr>
<td><code>DateSerial</code></td>
<td>Create date from components</td>
<td>year, month, day</td>
<td>Date (date only)</td>
</tr>
<tr>
<td><code>TimeValue</code></td>
<td>Parse time from string</td>
<td>time string</td>
<td>Date (time only)</td>
</tr>
<tr>
<td><code>DateValue</code></td>
<td>Parse date from string</td>
<td>date string</td>
<td>Date (date only)</td>
</tr>
<tr>
<td><code>CDate</code></td>
<td>Convert to date</td>
<td>expression</td>
<td>Date</td>
</tr>
</tbody>
</table>
<h2 id="platform-notes">Platform Notes</h2>
<ul>
<li>Available in VB6, VBA, and <code>VBScript</code></li>
<li>Consistent behavior across platforms</li>
<li>Automatic normalization of values</li>
<li>Date portion always zero (12/30/1899)</li>
<li>Works with standard Date type</li>
<li>Compatible with all date/time functions</li>
</ul>
<h2 id="limitations">Limitations</h2>
<ul>
<li>Returns only time portion (date is zero)</li>
<li>Cannot directly create date and time together (use <code>DateSerial</code> + <code>TimeSerial</code>)</li>
<li>No timezone support</li>
<li>No daylight saving time handling</li>
<li>Limited to standard time resolution (seconds)</li>
<li>Cannot create times with milliseconds</li>
<li>Normalization may produce unexpected results if not understood</li>
</ul>
        </article>
        
        <div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
            <p>
                <a href="index.html">← Back to Datetime</a> |
                <a href="../index.html">View all functions</a>
            </p>
        </div>

    </main>

    <footer>
        <div class="container">
            <p>&copy; 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
        </div>
    </footer>
</body>
</html>