What should I do to display midnight in datetime?

18 views (last 30 days)
I use a Matlab in the window.
If I enter the datetime like below,
The result does not show time. I want the result like (2019-09-08 00:00:00)
What should I do? :(
>> datetime(2019,9,8,0,0,0)
ans =
datetime
2019-09-08

Answers (1)

Stephen23
Stephen23 on 3 Aug 2020
>> dt = datetime(2019,9,8,0,0,0,'Format','yyyy-MM-dd HH:mm:ss')
dt =
2019-09-08 00:00:00

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!