Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

RES: Re: YYYYMMDD date format

 [1/2] from: carlos:lorenz at: 14-Nov-2000 15:46


Great! a liked it too Thanks Carlos Lorenz -----Mensagem original----- De: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]Em nome de [johnkenyon--uk--ibm--com] Enviada em: Terça-feira, 14 de Novembro de 2000 14:11 Para: [rebol-list--rebol--com] Assunto: [REBOL] Re: YYYYMMDD date format Mat, Probably no neater - but here goes ... pad: func [ value (integer!) figures (integer!) ] [ out: copy "" loop figures - length? to-string value [ append out "0" ] append out value ]
>I'd show you how I did it but it's really quite embarrassing ;)
I'm not much further ahead than you are :)
>Tell you something else I'd give my left one for, a straight port of >the Arexx parse command. I don't think I'll *ever* understand Rebols >:(
Arexx parse was nice but rebol parse is good fun. Just keep trying the examples and you never know... Cheers, John

 [2/2] from: carlos::lorenz::net at: 14-Nov-2000 15:46


That's why I like this list so much... I'm always learning good stuff in here Thanks Joel, Mat, John, Anton & Ryan Carlos Lorenz -----Mensagem original----- De: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]Em nome de Joel Neely Enviada em: Terça-feira, 14 de Novembro de 2000 14:17 Para: [rebol-list--rebol--com] Assunto: [REBOL] Re: YYYYMMDD date format Hi, Mat, John, Here's a QAD. zpad: func [n [number!] w [integer!] /local s] [ s: to-string n if w > length? s [ insert/dup s "0" (w - length? s) ] s ]
>> zpad 1 4 == "0001" >> zpad 123 2 == "123"
It pads to the desired length, but doesn't mess up if the number already requires more than the requested number of digits. Applying this to the original request...
>> rejoin [zpad now/year 4 zpad now/month 2 zpad now/day 2]
== "20001114" -jn- [rebol-bounce--rebol--com] wrote:
> Heya johnkenyon, > > juic> Hi, > > juic> now/month returns 1 not 01 for month in Jan so .. > > juic> nowdate: rejoin [ now/year either now/month < 10 [ "0" ] [ "" ]
now/month
> juic> now/day ] > Mmmm, that's interesting. I bet you could use that to make a VASTLY
<<quoted lines omitted: 19>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- ; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677 REBOL [] foreach [order string] sort/skip reduce [ true "!" false head reverse "rekcah" none "REBOL " prin "Just " "another " ] 2 [prin string] print ""

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted