Syntax
S=datestrroman([S])
Input Parameter
S : | | datestr YYYY-MM-DD; default is datestr |
Output Parameter
Examples
datestrroman
datestrroman('2012-04-03')
Copyright 2012-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, datestrroman
, converts a date string into a Roman numeral representation. It is part of the SolidGeometry library and was created by Tim Lueth.
Input Parameters
- S: A date string in the format 'YYYY-MM-DD'. If no input is provided, the current date is used as the default.
Output
- S: A string representing the date in Roman numerals.
Algorithm Steps
- Initialize
S
with the current date in 'YYYY-MM-DD' format using datestr(now, 'yyyy-mm-dd')
.
- Check if there is at least one input argument (
nargin >= 1
). If so, set S
to the first input argument.
- Verify if
S
is a character string. If not, convert it to a date string using datestr(S, 'yyyy-mm-dd')
.
- Extract the year, month, and day from the string
S
using str2num
on the respective substrings.
- Convert the year, month, and day to Roman numerals using the
roman
function.
- Format the Roman numeral date as a string in the format 'YYYY-MM-DD' using
sprintf
.
Example Usage
To convert the current date to Roman numerals, simply call datestrroman
without any arguments. To convert a specific date, such as '2012-04-03', call datestrroman('2012-04-03')
.
Algorithm explaination created using ChatGPT on 2025-08-18 22:36. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21