# Changing the time forma t on excel output

**URL:** <https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935>\
**Category:** 📊 Plotly Python\
**Created:** [March 15, 2022, 9:30am UTC](https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935 "2022-03-15T09:30:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Traxdata](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/traxdata/32/18031_2.png) [@Traxdata](https://community.plotly.com/u/Traxdata)\
**Post date:** [March 15, 2022, 9:30am UTC](https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935/1 "2022-03-15T09:30:34Z")

</div>

Hello all,  
So I’m wondering is there any chance to change the date format in the picture to 14.03.2022.  
This is my code for getting the excel sheet:

```auto
@app.callback(Output("link6", "children"),
             [Input("excel_data6", "data")],
            state=[State("start_date_picker", "date"),
            State("start_time_picker", "value"),
            State("end_date_picker", "date"),
            State("end_time_picker", "value"),
            State("database", "value")])
def download_sheet(output, start_date_picker, start_time_picker, end_date_picker, end_time_picker, database):
    if not output:
        return None
    df = pd.read_json(output, orient='split')
    df["Timestamp"] = df["Timestamp"].dt.tz_localize(None)
    start_time = datetime.datetime.strptime(start_date_picker, "%Y-%m-%d") + datetime.timedelta(hours=int(start_time_picker[0:2]))
    end_time = datetime.datetime.strptime(end_date_picker, "%Y-%m-%d") + datetime.timedelta(hours=int(end_time_picker[0:2]))
    xlsx_io = io.BytesIO()
    writer = pd.ExcelWriter(xlsx_io, engine='xlsxwriter', options={"remove_timezone" : True})
    df.to_excel(writer, sheet_name="Error Log")
    writer.save()
    xlsx_io.seek(0)
    # https://en.wikipedia.org/wiki/Data_URI_scheme
    media_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    data = base64.b64encode(xlsx_io.read()).decode("utf-8")
    href_data_downloadable = f'data:{media_type};base64,{data}'
    file_name = "Parameter_Log-{0}-{1}_{2}.xlsx".format(str(database), start_time, end_time)
    return html.A("Download Excel Sheet", download=file_name, href=href_data_downloadable)

```

![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/a/1/a11eb52f48ebd1d758bf8ff03c44cc177b9f91a1.png)

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [March 15, 2022, 1:31pm UTC](https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935/2 "2022-03-15T13:31:11Z")

</div>

That’s just Timestamp. Excel stores time as numbers, and what you see is not what it really looks like. The format you circle depends on your Excel settings. If you do really want it to look the way you want everywhere, you can convert it to strings.

---

<div class="post-metadata">

**Author:** ![Traxdata](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/traxdata/32/18031_2.png) [@Traxdata](https://community.plotly.com/u/Traxdata)\
**Post date:** [March 15, 2022, 2:19pm UTC](https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935/3 "2022-03-15T14:19:23Z")

</div>

Do you know what changes I need to do in excel for it to display it how I want?  
Thank you

---

<div class="post-metadata">

**Author:** ![stu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/stu/32/18439_2.png) [@stu](https://community.plotly.com/u/stu)\
**Post date:** [March 15, 2022, 2:30pm UTC](https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935/4 "2022-03-15T14:30:55Z")

</div>

Right-click, format cells.

---

<div class="post-metadata">

**Author:** ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)\
**Post date:** [March 15, 2022, 3:44pm UTC](https://community.plotly.com/t/changing-the-time-forma-t-on-excel-output/61935/5 "2022-03-15T15:44:29Z")

</div>

Hi @Traxdata  
@stu 's advice is a good solution. For similar challenges you can try to use a Python library called [Humanize](https://www.geeksforgeeks.org/humanize-package-in-python/).  
Or you can also try this post about [how to convert the string to a date type](https://stackoverflow.com/questions/466345/converting-string-into-datetime).
