after including new intrinsics like: __BUILD_DATE_ISO__ how about including a ISO-Date provider ...
This means, the user has the choice to either use: Date (USA-Date format) or: ISOD (ISO-Date format)
to do as s/he pleases, in their own code.
Advantages (it is of course "syntactic sugar" to a certain extent):
especially beginners might profit from such implementation however,
after a long time of having to exclusively deal with a clear minority favoring imlementation
I'm of the opinion, that it's high time to really go: international.
I'm proposing the following code (the "name" itself might be a point of debate, however):
Code: Select all
' ISOD_Func.bas -- (c) 2021-03-10, MrSwiss
'
' compile: -s console
'
Declare Function ISOD() ByRef As Const ZString ' ISO-Date provider
' ===== main =====
Print "USA-Date: "; Date ' just show the difference
Print "ISO-Date: "; ISOD ' REPLACEMENT for 'built-in' USA-Date
Print Chr(10) ' 2 x LineFeed (aka: LF)
Print "... done ... "; ' no LF (cursor remains at line end)
Sleep
' ===== end main =====
' implementation ...
Private Function ISOD() ByRef As Const ZString ' ISO-Date provider
Static As ZString * 11 idt, adt ' keeps data in-between calls
If Date <> adt Then ' only update on change or first call
adt = Date ' update comparator content
idt = Right(adt, 4) + "-" + _ ' year (first in ISO)
Left(adt, 2) + "-" + _ ' month (second in ISO)
Mid(adt, 4, 2) ' day (last/third in ISO)
End If
Return idt ' reference to internal static variable
End Function
' end implementation
' ----- EOF -----
Instead of ISOD it could alternatively and more verbose be called: ISODate, or similar.
Thoughts? Comments?