rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: rejetto on December 13, 2007, 05:02:55 AM
-
foggy asked me on how to change the date format from 13/12/2007 to 13-Dec-2007.
This is NOT meant to be a good method, i made it just to have fun and to test macros.
It's good for those who wants to know more on macros.
I created a user-macro called convert date.
{{set|convert date| {{\
{{set|x|{{replace|/|-|$1}} }}
{{cut|1|3|{{^x}}}}{{!Month{{cut|4|2|{{^x}} }} }}{{cut|6||{{^x}}}}
/}} }}
{{^convert date|13/12/2007}}
[special:strings]
Month01=Jan
Month02=Feb
Month03=Mar
Month04=Apr
.....
Month11=Nov
Month12=Dec
-
for those of you who enjoy fucking their own brain, the following is a sample of how you can get things in many ways.
foggy was waiting for the macro ">" that was introduced in the last version.
i wondered if it could be done with existing macros.
i didn't come to (and i won't try more because i'm tired) a real answer because i got the ">" by using "max" and "sub", and "sub" was introduced in the last beta as well, but i think this may be fun for someone.
{{>|A|B}} is equivalent to {{max| {{sub|A|B}} |0}}
explanation
case "false": when A is equal or less than B, the sub will be 0 or negative. the max between a number that is 0 or less, and zero, is of course zero, that is false in the macro language.
case "true": when A is greater than B, the sub will be 1 or more. the max between a number that is 1 or more, and zero, is of course the "1 or more", that is true in macro language.
i hope this was fun and/or useful for someone.
-
My brain hurts..
..but i'm still laughing :P
Macro's are really becoming something great now.
-
Hey yes, it is going to need for some people that they take the road of the school