-2

I am creating a python app (DASH app) check what is dash here (https://youtu.be/5BAthiN0htc) and I would like insert Today's DATE and TIME. Could you please help me on adding it to my app?

Thanks,

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
MGB.py
  • 461
  • 2
  • 9
  • 25

1 Answers1

3

Below I provide a solution for those who may have similar problem:

The code should be similar to below code and put it inside the DIV of your Dash App ( app.layout = html.Div([ ). I put atributes to allow you customize the format of display.

import datetime

html.Div([
                html.H1(
                datetime.datetime.now().strftime('%Y-%m-%d'), style=
{'opacity': '1','color': 'white', 'fontSize': 12}),
                html.H1(datetime.datetime.now().strftime('%H:%M:%S'), style=
{'opacity': '1','color': 'white', 'fontSize': 12}),
            ],

        ], 

        html.Br([]),


2018-02-24
19:33:39
MGB.py
  • 461
  • 2
  • 9
  • 25