How to change datetime format?
202 次查看(过去 30 天)
显示 更早的评论
Given this:
datetime('02-Jul-2023','InputFormat','dd-MMM-yyyy')
How can I get this format ?
datetime('02-Jul-2023 22:00:00')
0 个评论
采纳的回答
Stephen23
2023-6-13
编辑:Stephen23
2023-6-13
You can specify different formats for the input and display:
DT = datetime('02-Jul-2023','InputFormat','dd-MMM-yyyy', 'Format','dd-MMM-yyyy HH:mm:ss')
If it is an existing DATETIME object, then simply modify its FORMAT property as you wish, e.g.:
DT.Format = 'uuuuDDD' % ISO 8601 day-number format
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!