Date format: Difference between revisions

m
m (→‎{{header|Forth}}: fix markup)
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.
 
<LANGsyntaxhighlight FORTHlang="forth">\ Build up a "language" for date formatting
 
\ utility words
Line 1,950:
\ Rosetta Date Format 2
: LONG.DATE ( d m y -- )
3DUP CDAY DOW ]DAY$. ',' -ROT ]MONTH$. SPACE ##. ',' ####. ;</LANGsyntaxhighlight>
 
 
 
Test at the Forth Console
<LANGsyntaxhighlight FORTHlang="forth"> 5 7 2018 Y-M-D. 2018-07-05 ok
ok
5 7 2018 LONG.DATE Thursday, July 05, 2018 ok
</syntaxhighlight>
</LANG>
 
=={{header|Fortran}}==
10,333

edits