Quiz on new DATETIME data type

I created a Gemini Notebook with the Clarion PDF docs. I asked it to create a 20 Question Quiz.

I tried to make it public so you can try this link. You will need a Google Account but I think it won't work
https://notebooklm.link.google/4GKG29DBZyB1

Edit: this is a new "Clarion Docs" Notebook that I made Shared at creation. It has most of the PDFs.
https://notebook.google.com/notebook/17572b76-2fb9-470a-ae92-cee33f6876fe

Learn more about DATETIME with this Gemini made Slide Deck. There's a PDF inside the Zip.

Mastering_Clarion_DATETIME.zip (9.5 MB)


Simpler Quiz I'll paste it in Markdown next entry:

CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

Clarion DATETIME Data Type

20-Question Master Assessment & Detailed Answer Key

Overview: This master quiz tests core technical concepts regarding modern Clarion's scalar DATETIME data type, including its DECIMAL(19,7) internal representation, 100-nanosecond precision, epoch calculations, @C picture tokens, second-based arithmetic, DateTimeUtil helper class, and backend SQL driver mappings (MSSQL, PostgreSQL, Oracle, SQLite).

SECTION 1: QUIZ QUESTIONS

Q1. What is the primary purpose of the scalar DATETIME data type in modern Clarion?

A) To replace standard Clarion DATE and TIME fields in all local TopSpeed tables

B) To represent a unified date and time of day stored as a single scalar value, primarily mapping SQL timestamp columns

C) To convert Unix epoch timestamps into 32-bit integers

D) To store dates in string format for legacy Clipper compatibility

Q2. What is the underlying internal storage representation of a Clarion DATETIME variable?

A) A 4-byte signed LONG integer
B) An 8-byte composite GROUP over STRING(8)
C) A DECIMAL(19,7) (or PDECIMAL on Oracle)
D) A 64-bit IEEE 754 floating-point REAL

Q3. What is the maximum resolution/precision supported by the Clarion DATETIME data type?

A) 1 second
B) 1 millisecond
C) 1 microsecond
D) 100 nanoseconds

Q4. How does Clarion define the numeric epoch value zero for a DATETIME variable?

A) January 1, 1970 00:00:00
B) Midnight, December 28, 1800 (Clarion Standard Date zero)
C) January 1, 1900 00:00:00
D) January 1, 0001 00:00:00

Source-Grounded Clarion Reference Manuals Page 1
CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

Q5. What value represents a blank DATETIME in Clarion, and how is it handled when written to an SQL database?

A) Blank is represented by -1; it writes -1 to SQL

B) Blank is represented by 0; it writes NULL to SQL backends, and reading SQL NULL returns 0 C) Blank is represented by 86400; it writes 00:00:00 to SQL

D) Blank is represented by NULL; it throws a runtime error if assigned

Q6. Which picture token is used to format a DATETIME variable in ISO format (YYYY-MM-DD HH:MM:SS) showing whole seconds?

A) @D1
B) @T4
C) @C or @C0
D) @P#####P

Q7. What string length is required for a variable declared with the picture token STRING(@C7)?

A) 19 bytes
B) 21 bytes
C) 24 bytes
D) 27 bytes

Q8. An ENTRY control on a window uses the @C picture token for a DATETIME field. Which format will DEFORMAT() or the control accept?

A) Standard ISO string: '2026-09-09 13:05:07'

B) ISO string with 'T' separator: '2026-09-09T13:05:07.5'

C) Date-only string: '2026-09-09'

D) All of the above

Q9. How do addition and subtraction arithmetic operations operate directly on DATETIME values?

A) Operations add or subtract whole days (+1 adds 24 hours)

B) Operations operate directly in whole seconds (+3600 adds 1 hour; +86400 adds 1 day)

C) Operations add or subtract hundredths of a second

D) Operations require calling the CLOCK() procedure for each adjustment

Q10. What happens if you manually compute a DATETIME value using 'date * 86400' without specifying a decimal constant?

A) The expression evaluates correctly using 64-bit integer math

B) Integer overflow occurs because 32-bit LONG limits are exceeded for dates after January 1869

C) The compiler raises a syntax error

D) The time portion is automatically truncated to zero

Source-Grounded Clarion Reference Manuals Page 2
CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

Q11. What is the correct manual calculation formula to convert Clarion DATE and TIME fields into a DATETIME value?

A) dt = date * 86400 + time

B) dt = date * 86400.0 + CHOOSE(time = 0, 0, (time - 1) / 100)

C) dt = date + (time / 86400.0)

D) dt = (date + time) * 100.0

Q12. To use the DateTimeUtil helper class in a Clarion program module, which header file must be included?

A) CWUTIL.INC
B) DATETIME.INC
C) EQUATES.CLW
D) ABUTIL.INC

Q13. Which DateTimeUtil method captures the current system clock with 100-nanosecond precision?

A) DateTimeUtil.GetSystemTime()
B) DateTimeUtil.SetNow(dt)
C) DateTimeUtil.Clock()
D) DateTimeUtil.Today()

Q14. How does DateTimeUtil's Pict(dt, picture) method behave when formatting a DATETIME value?

A) It only accepts @C picture tokens

B) It allows formatting date or time parts using standard Clarion pictures like Pict(dt, '@D4') or Pict(dt, '@T4')

C) It converts the DATETIME into a CSTRING buffer

D) It converts the value into Unix epoch seconds

Q15. When a Clarion DATETIME value with fractional seconds is written to a Microsoft SQL Server smalldatetime column, what happens to fractional seconds?

A) They are rounded up to the nearest minute

B) They cause a driver error 47

C) They are truncated to fit the column's target scale

D) They are converted to a separate milliseconds column

Q16. Why do WATCH and PUT concurrency checks on legacy Microsoft SQL Server 'datetime' columns require extra caution with DATETIME fields?

A) Legacy MSSQL datetime columns store fractional seconds on a 1/300-second grid resolution, so optimistic concurrency checks only match exact grid fractions

B) Legacy datetime columns do not support NULL values

C) Legacy datetime columns throw a deadlock exception

D) Legacy datetime columns require 16-byte alignment

Source-Grounded Clarion Reference Manuals Page 3
CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

Q17. What target column type does the Clarion PostgreSQL / ODBC driver map to when a DATETIME field is created?

A) DATETIME
B) timestamp(6) (microsecond precision)
C) VARCHAR(27)
D) INT8

Q18. How does a Clarion VIEW process a filter expression containing a native DATETIME column when PROP:Filter is assigned?

A) The filter is evaluated locally line-by-line on the client PC

B) The driver translates the comparison into a native backend timestamp literal and evaluates it server-side

C) The filter is converted into a string comparison using @S27

D) Filters on DATETIME fields are not supported in VIEWs

Q19. How are parameter passing and reference variables restricted for DATETIME fields in Clarion procedure prototypes?

A) DATETIME fields can only be passed by value

B) DATETIME fields support &DATETIME; references and *DATETIME parameters, but passing by value is refused by the compiler

C) DATETIME fields must always be passed as LONG

D) DATETIME fields can only be passed inside a GROUP

Q20. What SQL import wizard setting controls whether database timestamp columns are imported as DATETIME or legacy GROUP overlays?

A) The 'Enable 64-bit Integer Support' checkbox

B) The 'Import date-time columns as DATETIME' checkbox (default OFF preserves 4-field GROUP shape)

C) The 'Use Legacy Drivers' checkbox

D) The 'Convert Dates to Strings' checkbox

Source-Grounded Clarion Reference Manuals Page 4

CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

SECTION 2: DETAILED ANSWER KEY & EXPLANATIONS

Q# Correct Answer Topic / Specification Area
Q1 Option B Primary Purpose & Unified Field Model
Q2 Option C Internal Storage Representation (DECIMAL(19,7))
Q3 Option D Maximum Resolution (100 nanoseconds)
Q4 Option B Numeric Epoch Definition (Dec 28, 1800)
Q5 Option B Zero / Blank Value Handling & SQL NULLs
Q6 Option C Formatting (@C / @C0 Whole Seconds)
Q7 Option D Picture Token @C7 & String Capacity (27 bytes)
Q8 Option D ENTRY Control & DEFORMAT Input Tolerances
Q9 Option B Second-Based Arithmetic Behavior
Q10 Option B 32-Bit LONG Overflow in Manual Math
Q11 Option B Correct Manual Calculation Formula
Q12 Option B DateTimeUtil Class Header File (DATETIME.INC)
Q13 Option B DateTimeUtil High-Precision Capture (SetNow)
Q14 Option B DateTimeUtil Formatting Methods (Pict)
Q15 Option C SQL Driver Fractional Truncation (smalldatetime)
Q16 Option A Optimistic Concurrency & MSSQL datetime 1/300s Grid
Q17 Option B PostgreSQL & ODBC Mapping (timestamp(6))
Q18 Option B VIEW PROP:Filter Server-Side Evaluation
Q19 Option B Procedure Prototype & Reference Rules
Q20 Option B SQL Dictionary Import Wizard Configuration

Detailed Explanations & Source Grounding

Q1: Option B

Explanation: Clarion's DATETIME data type represents a single scalar date-time value carrying full precision to map directly to backend SQL timestamp columns (such as SQL Server's datetime2, PostgreSQL timestamps, Oracle TIMESTAMP, and SQLite DATETIME).

Q2: Option C

Explanation: Under the hood, Clarion declares a DATETIME variable as a DECIMAL(19,7) (or PDECIMAL on Oracle) tagged automatically with the |DATETIME compiler attribute.

Q3: Option D

Explanation: DATETIME carries seven fractional decimal places of a second, providing precision up to 100 nanoseconds (0.0000001 second).

Source-Grounded Clarion Reference Manuals Page 5
CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

Q4: Option B

Explanation: A DATETIME value represents total seconds elapsed since midnight, December 28, 1800 (the Clarion Standard Date zero point).

Q5: Option B

Explanation: Numeric 0 represents a blank date-time. Writing a 0 value writes NULL to SQL database columns, and reading a backend NULL returns 0.

Q6: Option C

Explanation: @C (or @C0) displays whole seconds in 19-character ISO format (YYYY-MM-DD HH:MM:SS).

Q7: Option D

Explanation: @C7 adds 7 decimal places for fractional seconds (e.g. 2026-09-09 13:05:07.1234567), requiring exactly 27 characters.

Q8: Option D

Explanation: The @C picture token on ENTRY controls and in DEFORMAT accepts ISO standard strings, ISO strings with the 'T' separator, strings with fewer decimals, or date-only strings.

Q9: Option B

Explanation: Arithmetic on DATETIME operates in whole seconds: +3600 adds 1 hour, +86400 adds 1 day, and subtracting two DATETIME fields yields total seconds between them.

Q10: Option B

Explanation: Multiplying a DATE (LONG) by integer constant 86400 evaluates in integer math. For dates past Jan 1869, the product exceeds 2 billion and overflows 32-bit LONG limits.

Q11: Option B

Explanation: Writing '86400.0' forces decimal floating/BCD math stack evaluation, avoiding 32-bit integer overflow, while converting Clarion standard time (100ths sec since midnight + 1) into fractional day seconds.

Q12: Option B

Explanation: INCLUDE('DATETIME.INC') from LibSrc provides the DateTimeUtil helper class definition and exports.

Q13: Option B

Explanation: DateTimeUtil.SetNow(dt) captures the high-precision system clock down to 100 nanoseconds into the specified DATETIME variable.

Q14: Option B

Explanation: Pict(dt, picture) extracts and formats specific components using standard date (@D) or time (@T) picture tokens.

Q15: Option C

Explanation: When writing to smalldatetime or datetime2(N) columns with smaller scale, fractional seconds are truncated to match the column scale.

Q16: Option A

Explanation: Legacy MSSQL 'datetime' uses a 1/300-second storage grid. WATCH and PUT optimistic concurrency checks compare disk vs buffer values and only match if the DATETIME fraction aligns on that 1/300s grid.

Q17: Option B

Explanation: For PostgreSQL and ODBC drivers, DATETIME maps natively to timestamp(6), supporting microsecond resolution.

Source-Grounded Clarion Reference Manuals Page 6
CLARION PROGRAMMING β€” DATETIME DATA TYPE MASTER QUIZ

Q18: Option B

Explanation: Comparisons against a DATETIME field in a VIEW's PROP:Filter are converted by the driver into native database timestamp literals for server-side evaluation.

Q19: Option B

Explanation: Clarion supports &DATETIME; reference variables and *DATETIME procedure parameters; passing DATETIME by value is disallowed by the compiler.

Q20: Option B

Explanation: SQL import wizards feature an 'Import date-time columns as DATETIME' checkbox. Leaving it unchecked (default) preserves the legacy 4-field STRING(8)+GROUP overlay structure.

Source-Grounded Clarion Reference Manuals Page 7