Basic.DateTimes
Simple function to centralize datetime formats in a model. Returns a standardized datetime format string that includes both date and time components for consistent timestamp display across your data model.
Syntax
DaxLib.FormatString.Basic.DateTimes ( )
Definition
DAX
// Simple function to centralize datetime formats in a model.
// Main benefit is that if you want to change it, you only have to do it in one place.
//
// Recommended: Use a Tabular Editor Macro to assign this function to the format string of every DateTime field.
( ) => "yyyy-MM-dd HH:mm:ss"
-- e.g. 12/25/2025 2:30 PM (US Format with 12-hour Time)
-- "MM/dd/yyyy h:mm AM/PM"
-- e.g. 25/12/2025 14:30 (European Format with 24-hour Time)
-- "dd/MM/yyyy HH:mm"
-- e.g. Dec 25, 2025 2:30:45 PM (Abbreviated Month with Full Time)
-- "MMM dd, yyyy h:mm:ss AM/PM"
-- e.g. 2025-12-25T14:30:00 (ISO 8601 Standard with T Separator)
-- "yyyy-MM-dd\THH:mm:ss"
-- e.g. 25-Dec-2025 14:30 (Day-Month-Year with Time)
-- "dd-MMM-yyyy HH:mm"
-- e.g. December 25, 2025 at 2:30 PM (Full Month with "at")
-- "MMMM dd, yyyy \a\t h:mm AM/PM"
-- e.g. Thu, Dec 25, 2025 14:30:00 (Abbreviated Day with Full Time)
-- "ddd, MMM dd, yyyy HH:mm:ss"
-- e.g. 2025-12-25 14:30 (Compact ISO Format)
-- "yyyy-MM-dd HH:mm"
-- e.g. 12/25 2:30 PM (Short Format without Year)
-- "MM/dd h:mm AM/PM"
Parameters
This function takes no parameters.
Example
DaxLib.FormatString.Basic.DateTimes ()
Use this function in a measure's formatStringDefinition to apply standardized datetime formatting.
Related Functions
- Basic.Dates - Date-only formatting
- Basic.Months - Month-level formatting
- HHMMSS.StartTimeEndTime - Duration formatting