StyleCode Property: dateFormat

dateFormat

Specifies the format used to print out dates.

Applies to Type Default
chart > haxis
linechart > haxis > value
scalar > entry > value
slicepicker > entry
summary > entry > value
table > column > value
dayFormat default

Examples

// Example: linechart > haxis > value
table Day[Date] = with
  [| as Date, as StockOnHand, as StockOnOrder |]
  [| date(2023,01,15), 15,10 |]
  [| date(2023,01,16), 5, 2 |]
  [| date(2023,01,17), 12, 4 |]
  [| date(2023,01,18), 13, 7 |]

{ haxis { value { dateFormat: "ddd MMM d, yyyy" } } }
show linechart "My Line Chart" a1b6 with
  Day.StockOnHand
  Day.StockOnOrder

// Example: scalar > entry > value
myValue = 123

show scalar "My Scalar" a1b1 with
  myValue { value { dateFormat: "ddd MMM d, yyyy" } }

// Example: slicepicker > entry
table Items = with
  [| as Id |]
  [| "A" |]
  [| "B" |]
  [| "C" |]

Items.Slice = sliceDashboard(Items.Id) by Items.Id

show slicepicker "Pick a slice" a1b3 with
  same(Items.Id) { dateFormat: "ddd MMM d, yyyy" }

// Example: summary > entry > value
table Sales = with
  [| as Quantity, as NetAmount |]
  [| 10, 40 |]
  [| 2, 10 |]
  [| 1, 20 |]
    
show summary "My Summary" a1b3 with
  sum(Sales.Quantity) { value { dateFormat: "ddd MMM d, yyyy" } }
  sum(Sales.NetAmount)

// Example: table > column > value
table Orders = with
  [| as Date, as Quantity |]
  [| date(2023,02,21), 150 |]
  [| date(2023,02,22), 250 |]

show table "My Table" a1c4 with
  Orders.Date { value { dateFormat: "ddd MMM d, yyyy" } }
  Orders.Quantity

Details

The default value will be interpreted differently depending on the context. It usually is ddd MMM d, yyyy (e.g. “Mon Jan 1, 2001”) but will be instead MMM d, yyyy (e.g. “Jan 1, 2001”) in narrow contexts, such as a scalar tile of width 1.

User Contributed Notes
0 notes + add a note