Date format: Difference between revisions
Content added Content deleted
m (→{{header|Joy}}) |
Thundergnat (talk | contribs) m (→{{header|Forth}}: fix markup) |
||
Line 1,890: | Line 1,890: | ||
Forth is less of a language and more of an extensible toolkit of simple routines. This version attempts to demonstrate using the simple routines to extend Forth. Then using the language extensions and the power of concatenative language to solve the problem. This solution could create numerous date formats as one line definitions now that we have our "date" words defined. Typically these extensions would be saved as a library file. |
Forth is less of a language and more of an extensible toolkit of simple routines. This version attempts to demonstrate using the simple routines to extend Forth. Then using the language extensions and the power of concatenative language to solve the problem. This solution could create numerous date formats as one line definitions now that we have our "date" words defined. Typically these extensions would be saved as a library file. |
||
< |
<syntaxhighlight lang="forth">\ Build up a "language" for date formatting |
||
\ utility words |
\ utility words |
||
Line 1,950: | Line 1,950: | ||
\ Rosetta Date Format 2 |
\ Rosetta Date Format 2 |
||
: LONG.DATE ( d m y -- ) |
: LONG.DATE ( d m y -- ) |
||
3DUP CDAY DOW ]DAY$. ',' -ROT ]MONTH$. SPACE ##. ',' ####. ;</ |
3DUP CDAY DOW ]DAY$. ',' -ROT ]MONTH$. SPACE ##. ',' ####. ;</syntaxhighlight> |
||
Test at the Forth Console |
Test at the Forth Console |
||
< |
<syntaxhighlight lang="forth"> 5 7 2018 Y-M-D. 2018-07-05 ok |
||
ok |
ok |
||
5 7 2018 LONG.DATE Thursday, July 05, 2018 ok |
5 7 2018 LONG.DATE Thursday, July 05, 2018 ok |
||
</syntaxhighlight> |
|||
</LANG> |
|||
=={{header|Fortran}}== |
=={{header|Fortran}}== |