Matlab has the in-built function datestr()
which can be used to get the desired format of date.
Here is an example to get the date in the format of yyyy-mm-dd
:
main.m62 chars3 lines
This code will return a string of the current date in the format yyyy-mm-dd
.
You can modify the formatOut
variable to get the date in a different format as per the requirement.
Note: The now
function returns the current date and time. You can replace this with any date value for which you want to get the formatted date.
gistlibby LogSnag