Format Date Time in AgGrid

@PablocFonseca can you show how format a Datetime in a AgGrid.
I’ve tried unsuccessfully to use valueFormatter as shown below:

gb.configure_column("date_column", header_name="Activation Date",valueFormatter="data.date_column.toLocaleDateString('it-IT',{ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })", editable=False)

Could you help me please?

Since AgGrid uses pandas, it seems that you could utilize pandas.to_datetime and something like --df[‘date_column_name’].dt.strftime(’%d-%m-%Y’) to format the date variable or to create another column with the desired format.

I know it’s feasible but it doesn’t meet my need.

I want to use dates an filter them using calendar widget

This may be a functionality question for @PablocFonseca.

@PablocFonseca can you halp me on this topic?


You’ll need to use valueFormatter in column definition. Check JavaScript Data Grid: Cell Expressions.

Using the gridBuilder you could try something like, I’ve coded some helpful comlumn types:

gb.configure_column("date_column", type=["customDateTimeFormat"], custom_format_string='yyyy-MM-dd HH:mm zzz')

Let me know if it works

Thank you @PablocFonseca it works