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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
//! # Now Function
//!
//! Returns a Variant (Date) specifying the current date and time according to the setting of the computer's system date and time.
//!
//! ## Syntax
//!
//! ```vb
//! Now
//! ```
//!
//! ## Parameters
//!
//! None. Now takes no parameters.
//!
//! ## Return Value
//!
//! Returns a **Variant (Date)** containing the current system date and time.
//!
//! The returned value includes both the date portion (number of days since December 30, 1899) and the time portion (fractional part of a 24-hour day).
//!
//! ## Remarks
//!
//! The Now function is one of the most frequently used VB6 date/time functions for getting the current moment.
//! It combines both date and time information in a single value.
//!
//! ### Key Characteristics:
//! - Returns both date and time components
//! - Based on computer's system clock
//! - No parameters required (parameterless function)
//! - Commonly used for timestamps, logging, and timing operations
//! - Can be separated into date-only or time-only using `Date()` or `Time()`
//! - Precision to the second (does not include milliseconds)
//! - Returns Variant (Date) type
//! - Subject to system time zone settings
//!
//! ### Comparison with Related Functions:
//! - **Date** - Returns only the date portion (time is midnight)
//! - **Time** - Returns only the time portion (date is December 30, 1899)
//! - **Now** - Returns both date and time components
//! - **Timer** - Returns seconds since midnight as Single (for precision timing)
//!
//! ### Common Use Cases:
//! - Create timestamps for logging
//! - Record when events occur
//! - Calculate elapsed time
//! - Display current date and time to users
//! - Set default values for date fields
//! - Generate time-based filenames
//! - Track operation start/end times
//! - Audit trail creation
//!
//! ## Typical Uses
//!
//! 1. **Timestamps** - Record when operations occur
//! 2. **Logging** - Add timestamps to log entries
//! 3. **Audit Trails** - Track when records are created/modified
//! 4. **Performance Timing** - Measure operation duration
//! 5. **Display Current Time** - Show users the current date/time
//! 6. **Default Values** - Initialize date fields with current date/time
//! 7. **File Naming** - Create time-stamped file names
//! 8. **Session Tracking** - Record login/logout times
//!
//! ## Basic Examples
//!
//! ```vb
//! ' Example 1: Get current date and time
//! Dim currentDateTime As Date
//! currentDateTime = Now
//! ```
//!
//! ```vb
//! ' Example 2: Display to user
//! MsgBox "Current time is: " & Now
//! ```
//!
//! ```vb
//! ' Example 3: Create timestamp
//! Dim timestamp As String
//! timestamp = Format(Now, "yyyy-mm-dd hh:nn:ss")
//! ```
//!
//! ```vb
//! ' Example 4: Calculate elapsed time
//! Dim startTime As Date
//! startTime = Now
//! ' ... do some work ...
//! MsgBox "Elapsed: " & DateDiff("s", startTime, Now) & " seconds"
//! ```
//!
//! ## Common Patterns
//!
//! ```vb
//! ' Pattern 1: Simple timestamp logging
//! Sub LogMessage(message As String)
//! Debug.Print Now & " - " & message
//! End Sub
//! ```
//!
//! ```vb
//! ' Pattern 2: Formatted timestamp
//! Function GetTimestamp() As String
//! GetTimestamp = Format(Now, "yyyy-mm-dd hh:nn:ss")
//! End Function
//! ```
//!
//! ```vb
//! ' Pattern 3: Calculate operation duration
//! Function MeasureOperation() As Double
//! Dim startTime As Date
//! Dim endTime As Date
//!
//! startTime = Now
//!
//! ' Perform operation
//! DoSomething
//!
//! endTime = Now
//!
//! ' Return elapsed seconds
//! MeasureOperation = DateDiff("s", startTime, endTime)
//! End Function
//! ```
//!
//! ```vb
//! ' Pattern 4: Audit trail update
//! Sub UpdateRecord(recordID As Long)
//! Dim sql As String
//! sql = "UPDATE Records SET ModifiedDate = " & _
//! Format(Now, "\#mm\/dd\/yyyy hh:nn:ss\#") & _
//! " WHERE ID = " & recordID
//! ExecuteSQL sql
//! End Sub
//! ```
//!
//! ```vb
//! ' Pattern 5: Time-stamped filename
//! Function GetLogFileName() As String
//! GetLogFileName = "log_" & Format(Now, "yyyymmdd_hhnnss") & ".txt"
//! End Function
//! ```
//!
//! ```vb
//! ' Pattern 6: Session tracking
//! Sub RecordLogin(userID As Long)
//! Dim loginTime As Date
//! loginTime = Now
//!
//! ' Store in database or session object
//! Session("LoginTime") = loginTime
//! Session("UserID") = userID
//! End Sub
//! ```
//!
//! ```vb
//! ' Pattern 7: Timeout checking
//! Function IsTimedOut(startTime As Date, timeoutMinutes As Long) As Boolean
//! Dim elapsed As Long
//! elapsed = DateDiff("n", startTime, Now)
//! IsTimedOut = (elapsed >= timeoutMinutes)
//! End Function
//! ```
//!
//! ```vb
//! ' Pattern 8: Scheduled task checking
//! Function ShouldRunTask(lastRun As Date, intervalHours As Long) As Boolean
//! Dim hoursSinceRun As Long
//!
//! If IsNull(lastRun) Then
//! ShouldRunTask = True
//! Else
//! hoursSinceRun = DateDiff("h", lastRun, Now)
//! ShouldRunTask = (hoursSinceRun >= intervalHours)
//! End If
//! End Function
//! ```
//!
//! ```vb
//! ' Pattern 9: Display relative time
//! Function GetTimeAgo(pastTime As Date) As String
//! Dim seconds As Long
//! Dim minutes As Long
//! Dim hours As Long
//!
//! seconds = DateDiff("s", pastTime, Now)
//!
//! If seconds < 60 Then
//! GetTimeAgo = seconds & " seconds ago"
//! ElseIf seconds < 3600 Then
//! minutes = seconds \ 60
//! GetTimeAgo = minutes & " minutes ago"
//! Else
//! hours = seconds \ 3600
//! GetTimeAgo = hours & " hours ago"
//! End If
//! End Function
//! ```
//!
//! ```vb
//! ' Pattern 10: Business hours check
//! Function IsDuringBusinessHours() As Boolean
//! Dim currentHour As Integer
//! Dim currentDay As Integer
//!
//! currentHour = Hour(Now)
//! currentDay = Weekday(Now)
//!
//! ' Monday-Friday, 9 AM to 5 PM
//! IsDuringBusinessHours = (currentDay >= vbMonday And currentDay <= vbFriday) And _
//! (currentHour >= 9 And currentHour < 17)
//! End Function
//! ```
//!
//! ## Advanced Usage
//!
//! ### Example 1: Performance Monitor Class
//!
//! ```vb
//! ' Class: PerformanceMonitor
//! ' Tracks operation performance with detailed timing
//!
//! Option Explicit
//!
//! Private m_operations As Collection
//!
//! Private Type OperationTiming
//! operationName As String
//! startTime As Date
//! endTime As Date
//! duration As Double
//! End Type
//!
//! Private Sub Class_Initialize()
//! Set m_operations = New Collection
//! End Sub
//!
//! Public Sub StartOperation(operationName As String)
//! Dim timing As OperationTiming
//!
//! timing.operationName = operationName
//! timing.startTime = Now
//! timing.endTime = 0
//! timing.duration = 0
//!
//! m_operations.Add timing, operationName
//! End Sub
//!
//! Public Sub EndOperation(operationName As String)
//! Dim timing As OperationTiming
//! Dim i As Long
//!
//! ' Find the operation
//! For i = 1 To m_operations.Count
//! timing = m_operations(i)
//! If timing.operationName = operationName Then
//! timing.endTime = Now
//! timing.duration = DateDiff("s", timing.startTime, timing.endTime)
//!
//! ' Update the collection
//! m_operations.Remove i
//! m_operations.Add timing, operationName
//! Exit Sub
//! End If
//! Next i
//! End Sub
//!
//! Public Function GetDuration(operationName As String) As Double
//! Dim timing As OperationTiming
//! Dim i As Long
//!
//! For i = 1 To m_operations.Count
//! timing = m_operations(i)
//! If timing.operationName = operationName Then
//! If timing.endTime = 0 Then
//! ' Still running - calculate current duration
//! GetDuration = DateDiff("s", timing.startTime, Now)
//! Else
//! GetDuration = timing.duration
//! End If
//! Exit Function
//! End If
//! Next i
//!
//! GetDuration = -1 ' Not found
//! End Function
//!
//! Public Function GenerateReport() As String
//! Dim report As String
//! Dim timing As OperationTiming
//! Dim i As Long
//!
//! report = "Performance Report - " & Format(Now, "yyyy-mm-dd hh:nn:ss") & vbCrLf
//! report = report & String(60, "-") & vbCrLf
//!
//! For i = 1 To m_operations.Count
//! timing = m_operations(i)
//! report = report & timing.operationName & ": "
//!
//! If timing.endTime = 0 Then
//! report = report & "Running (" & DateDiff("s", timing.startTime, Now) & "s)"
//! Else
//! report = report & timing.duration & " seconds"
//! End If
//!
//! report = report & vbCrLf
//! Next i
//!
//! GenerateReport = report
//! End Function
//! ```
//!
//! ### Example 2: Audit Logger Class
//!
//! ```vb
//! ' Class: AuditLogger
//! ' Logs all database operations with timestamps
//!
//! Option Explicit
//!
//! Private m_logFile As String
//! Private m_enabled As Boolean
//!
//! Public Sub Initialize(logFilePath As String)
//! m_logFile = logFilePath
//! m_enabled = True
//! End Sub
//!
//! Public Sub LogInsert(tableName As String, recordID As Variant, userName As String)
//! Dim entry As String
//! entry = FormatLogEntry("INSERT", tableName, recordID, userName, "")
//! WriteToLog entry
//! End Sub
//!
//! Public Sub LogUpdate(tableName As String, recordID As Variant, userName As String, changes As String)
//! Dim entry As String
//! entry = FormatLogEntry("UPDATE", tableName, recordID, userName, changes)
//! WriteToLog entry
//! End Sub
//!
//! Public Sub LogDelete(tableName As String, recordID As Variant, userName As String)
//! Dim entry As String
//! entry = FormatLogEntry("DELETE", tableName, recordID, userName, "")
//! WriteToLog entry
//! End Sub
//!
//! Public Sub LogSelect(tableName As String, userName As String, criteria As String)
//! Dim entry As String
//! entry = FormatLogEntry("SELECT", tableName, "", userName, criteria)
//! WriteToLog entry
//! End Sub
//!
//! Private Function FormatLogEntry(operation As String, _
//! tableName As String, _
//! recordID As Variant, _
//! userName As String, _
//! details As String) As String
//! Dim entry As String
//!
//! entry = Format(Now, "yyyy-mm-dd hh:nn:ss") & vbTab
//! entry = entry & operation & vbTab
//! entry = entry & tableName & vbTab
//! entry = entry & CStr(recordID) & vbTab
//! entry = entry & userName & vbTab
//! entry = entry & details
//!
//! FormatLogEntry = entry
//! End Function
//!
//! Private Sub WriteToLog(entry As String)
//! Dim fileNum As Integer
//!
//! If Not m_enabled Then Exit Sub
//!
//! On Error Resume Next
//! fileNum = FreeFile
//! Open m_logFile For Append As #fileNum
//! Print #fileNum, entry
//! Close #fileNum
//! On Error GoTo 0
//! End Sub
//!
//! Public Function GetRecentEntries(minutes As Long) As Collection
//! Dim entries As New Collection
//! Dim fileNum As Integer
//! Dim line As String
//! Dim timestamp As Date
//! Dim cutoffTime As Date
//!
//! cutoffTime = DateAdd("n", -minutes, Now)
//!
//! On Error Resume Next
//! fileNum = FreeFile
//! Open m_logFile For Input As #fileNum
//!
//! Do While Not EOF(fileNum)
//! Line Input #fileNum, line
//!
//! ' Parse timestamp from first field
//! timestamp = CDate(Left(line, 19))
//!
//! If timestamp >= cutoffTime Then
//! entries.Add line
//! End If
//! Loop
//!
//! Close #fileNum
//! On Error GoTo 0
//!
//! Set GetRecentEntries = entries
//! End Function
//! ```
//!
//! ### Example 3: Session Manager Module
//!
//! ```vb
//! ' Module: SessionManager
//! ' Manages user sessions with timeout tracking
//!
//! Option Explicit
//!
//! Private Type UserSession
//! userID As Long
//! userName As String
//! loginTime As Date
//! lastActivity As Date
//! ipAddress As String
//! isActive As Boolean
//! End Type
//!
//! Private m_sessions As Collection
//! Private m_timeoutMinutes As Long
//!
//! Public Sub Initialize(timeoutMinutes As Long)
//! Set m_sessions = New Collection
//! m_timeoutMinutes = timeoutMinutes
//! End Sub
//!
//! Public Function CreateSession(userID As Long, userName As String, ipAddress As String) As String
//! Dim session As UserSession
//! Dim sessionID As String
//!
//! ' Generate unique session ID
//! sessionID = GenerateSessionID()
//!
//! session.userID = userID
//! session.userName = userName
//! session.loginTime = Now
//! session.lastActivity = Now
//! session.ipAddress = ipAddress
//! session.isActive = True
//!
//! m_sessions.Add session, sessionID
//!
//! CreateSession = sessionID
//! End Function
//!
//! Public Sub UpdateActivity(sessionID As String)
//! Dim session As UserSession
//!
//! On Error Resume Next
//! session = m_sessions(sessionID)
//!
//! If Err.Number = 0 Then
//! session.lastActivity = Now
//! m_sessions.Remove sessionID
//! m_sessions.Add session, sessionID
//! End If
//! On Error GoTo 0
//! End Sub
//!
//! Public Function IsSessionValid(sessionID As String) As Boolean
//! Dim session As UserSession
//! Dim minutesIdle As Long
//!
//! On Error Resume Next
//! session = m_sessions(sessionID)
//!
//! If Err.Number <> 0 Then
//! IsSessionValid = False
//! Exit Function
//! End If
//! On Error GoTo 0
//!
//! If Not session.isActive Then
//! IsSessionValid = False
//! Exit Function
//! End If
//!
//! minutesIdle = DateDiff("n", session.lastActivity, Now)
//! IsSessionValid = (minutesIdle < m_timeoutMinutes)
//! End Function
//!
//! Public Sub CleanupExpiredSessions()
//! Dim session As UserSession
//! Dim sessionID As Variant
//! Dim minutesIdle As Long
//! Dim expiredIDs As Collection
//!
//! Set expiredIDs = New Collection
//!
//! ' Find expired sessions
//! For Each sessionID In m_sessions
//! session = m_sessions(sessionID)
//! minutesIdle = DateDiff("n", session.lastActivity, Now)
//!
//! If minutesIdle >= m_timeoutMinutes Then
//! expiredIDs.Add sessionID
//! End If
//! Next sessionID
//!
//! ' Remove expired sessions
//! For Each sessionID In expiredIDs
//! m_sessions.Remove sessionID
//! Next sessionID
//! End Sub
//!
//! Public Function GetSessionDuration(sessionID As String) As Long
//! Dim session As UserSession
//!
//! On Error Resume Next
//! session = m_sessions(sessionID)
//!
//! If Err.Number = 0 Then
//! GetSessionDuration = DateDiff("n", session.loginTime, Now)
//! Else
//! GetSessionDuration = 0
//! End If
//! On Error GoTo 0
//! End Function
//!
//! Private Function GenerateSessionID() As String
//! GenerateSessionID = Format(Now, "yyyymmddhhnnss") & "_" & Int(Rnd * 10000)
//! End Function
//! ```
//!
//! ### Example 4: Scheduled Task Runner
//!
//! ```vb
//! ' Class: ScheduledTaskRunner
//! ' Executes tasks on a schedule based on current time
//!
//! Option Explicit
//!
//! Private Type ScheduledTask
//! taskName As String
//! lastRun As Date
//! intervalMinutes As Long
//! enabled As Boolean
//! callbackObject As Object
//! callbackMethod As String
//! End Type
//!
//! Private m_tasks As Collection
//!
//! Private Sub Class_Initialize()
//! Set m_tasks = New Collection
//! End Sub
//!
//! Public Sub AddTask(taskName As String, _
//! intervalMinutes As Long, _
//! callbackObj As Object, _
//! callbackMethod As String)
//! Dim task As ScheduledTask
//!
//! task.taskName = taskName
//! task.lastRun = 0
//! task.intervalMinutes = intervalMinutes
//! task.enabled = True
//! Set task.callbackObject = callbackObj
//! task.callbackMethod = callbackMethod
//!
//! m_tasks.Add task, taskName
//! End Sub
//!
//! Public Sub CheckAndRunTasks()
//! Dim task As ScheduledTask
//! Dim i As Long
//! Dim minutesSinceRun As Long
//!
//! For i = 1 To m_tasks.Count
//! task = m_tasks(i)
//!
//! If task.enabled Then
//! If task.lastRun = 0 Then
//! ' Never run - execute now
//! ExecuteTask task
//! task.lastRun = Now
//! UpdateTask i, task
//! Else
//! minutesSinceRun = DateDiff("n", task.lastRun, Now)
//!
//! If minutesSinceRun >= task.intervalMinutes Then
//! ExecuteTask task
//! task.lastRun = Now
//! UpdateTask i, task
//! End If
//! End If
//! End If
//! Next i
//! End Sub
//!
//! Private Sub ExecuteTask(task As ScheduledTask)
//! On Error Resume Next
//! CallByName task.callbackObject, task.callbackMethod, VbMethod
//!
//! If Err.Number <> 0 Then
//! Debug.Print "Task execution error: " & task.taskName & " - " & Err.Description
//! End If
//! On Error GoTo 0
//! End Sub
//!
//! Private Sub UpdateTask(index As Long, task As ScheduledTask)
//! Dim taskName As String
//! taskName = task.taskName
//!
//! m_tasks.Remove index
//! m_tasks.Add task, taskName
//! End Sub
//!
//! Public Function GetNextRunTime(taskName As String) As Date
//! Dim task As ScheduledTask
//!
//! On Error Resume Next
//! task = m_tasks(taskName)
//!
//! If Err.Number = 0 Then
//! If task.lastRun = 0 Then
//! GetNextRunTime = Now ' Will run immediately
//! Else
//! GetNextRunTime = DateAdd("n", task.intervalMinutes, task.lastRun)
//! End If
//! End If
//! On Error GoTo 0
//! End Function
//!
//! Public Sub EnableTask(taskName As String)
//! Dim task As ScheduledTask
//! Dim i As Long
//!
//! For i = 1 To m_tasks.Count
//! task = m_tasks(i)
//! If task.taskName = taskName Then
//! task.enabled = True
//! UpdateTask i, task
//! Exit Sub
//! End If
//! Next i
//! End Sub
//!
//! Public Sub DisableTask(taskName As String)
//! Dim task As ScheduledTask
//! Dim i As Long
//!
//! For i = 1 To m_tasks.Count
//! task = m_tasks(i)
//! If task.taskName = taskName Then
//! task.enabled = False
//! UpdateTask i, task
//! Exit Sub
//! End If
//! Next i
//! End Sub
//! ```
//!
//! ## Error Handling
//!
//! ```vb
//! ' Now rarely fails, but system clock issues can occur:
//! On Error Resume Next
//! Dim currentTime As Date
//! currentTime = Now
//! If Err.Number <> 0 Then
//! MsgBox "Unable to get system time: " & Err.Description
//! ' Use a default or cached value
//! End If
//! On Error GoTo 0
//! ```
//!
//! ## Performance Considerations
//!
//! - Now is a fast function - safe to call frequently
//! - For high-precision timing, use Timer function instead
//! - Does not include milliseconds - precision is to the second
//! - Caching Now value in tight loops can improve performance slightly
//! - System clock access is generally very fast
//! - No performance difference between Now, Date, and Time functions
//!
//! ## Best Practices
//!
//! 1. **Use for timestamps** - Ideal for logging and audit trails
//! 2. **Store in Date variables** - Declare as Date type, not Variant when possible
//! 3. **Format for display** - Use `Format()` function for user-friendly output
//! 4. **Consider time zones** - Now uses local system time, not UTC
//! 5. **Use Timer for precision** - For sub-second timing, use Timer function
//! 6. **Cache in loops** - Store Now once at loop start instead of calling repeatedly
//! 7. **Document timezone** - Make it clear whether times are local or UTC
//! 8. **Use `DateDiff` carefully** - Be aware of daylight saving time changes
//! 9. **Validate before math** - Check for valid dates before date arithmetic
//! 10. **Consider Date vs Now** - Use Date if you only need the date portion
//!
//! ## Comparison with Alternatives
//!
//! | Function | Date Component | Time Component | Use Case |
//! |----------|---------------|----------------|----------|
//! | **Now** | Yes (current) | Yes (current) | Full timestamp |
//! | **Date** | Yes (current) | No (midnight) | Date-only operations |
//! | **Time** | No (12/30/1899) | Yes (current) | Time-only operations |
//! | **Timer** | No | Yes (as Single) | High-precision timing |
//!
//! ## Platform Notes
//!
//! - Available in VBA (Excel, Access, Word, etc.)
//! - Available in VB6
//! - Available in `VBScript`
//! - Uses Windows system clock
//! - Subject to system time zone settings
//! - Affected by daylight saving time changes
//! - No parameters required (parameterless function)
//! - Returns local time, not UTC
//!
//! ## Limitations
//!
//! - Returns local time only (no UTC option)
//! - Precision limited to seconds (no milliseconds)
//! - Subject to system clock changes
//! - Date range: January 1, 100 to December 31, 9999
//! - Can be affected by daylight saving time transitions
//! - No built-in time zone conversion
//! - Depends on accurate system clock
//!
//! ## Related Functions
//!
//! - **Date** - Returns current date (time = midnight)
//! - **Time** - Returns current time (date = 12/30/1899)
//! - **Timer** - Returns seconds since midnight (for precision timing)
//! - **`DateAdd`** - Adds time intervals to dates
//! - **`DateDiff`** - Calculates difference between dates
//! - **Format** - Formats date/time for display
//!
//! ## VB6 Parser Notes
//!
//! Now is a parameterless function that is parsed as a `CallExpression`. This module exists primarily
//! for documentation purposes to provide comprehensive reference material for VB6 developers working
//! with date and time operations, timestamps, logging, and time-based calculations.
use crate::;
/// Implementation of the `Now` function.
///
/// VB6 behavior:
/// - returns the current system date and time as a `Date` variant
/// - the time portion is included as the fractional part of the date serial
/// - never raises an error