-3

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
  • 963,270
  • 265
  • 3,804
  • 3,187
MGB.py
  • 431
  • 2
  • 8
  • 22

1 Answers1

2

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
  • 431
  • 2
  • 8
  • 22