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

12-hour format

 [1/6] from: mgkiourt::otenet::gr at: 5-Oct-2001 9:56


How can I transform a 24-hour to 12-hour form e.g.,13:10 to 1:10? Thanks.Mike

 [2/6] from: carl:cybercraft at: 5-Oct-2001 19:23


On 05-Oct-01, mgkiourt wrote:
> How can I transform a 24-hour to 12-hour form e.g.,13:10 to 1:10? > Thanks.Mike
This is such a common request that it would make sense for RT to include a switch for it as a refinement in time-related words. Which doesn't help Mike at the moment, but I'm sure plenty here have already a function for this... -- Carl Read

 [3/6] from: greggirwin:starband at: 5-Oct-2001 1:53


Hi Mike, << How can I transform a 24-hour to 12-hour form e.g.,13:10 to 1:10? >> This came up some time ago. Here's what Allen Kamp posted, with original credit given to Carl: nice-time: func [time /local am][ time/3: 0 am: pick [" AM" " PM"] time < 12:00 if time >= 12:00 [time: time - 12:00] if time/1 = 0 [time/1: 12] rejoin [time am] ] I think some others may have improved upon it as well. --Gregg

 [4/6] from: joel:neely:fedex at: 5-Oct-2001 2:04


mgkiourt wrote:
> How can I transform a 24-hour to 12-hour form e.g.,13:10 to 1:10? > Thanks.Mike >
to-12-hr: func [t [time!]] [ if t/hour > 12 [t/hour: t/hour - 12] t ]
>> when2: to-12-hr
13:10 == 1:10 -- Sea lions can open and close their nostrils at will. This would come in handy on usenet. -- Aaron Watters joel#dot#neely#at#fedex#FIX#PUNCTUATION#dot#com

 [5/6] from: mgkiourt:otenet:gr at: 5-Oct-2001 16:22


----- Original Message ----- From: Joel Neely <[joel--neely--fedex--com]> To: <[rebol-list--rebol--com]> Sent: Friday, October 05, 2001 10:04 AM Subject: [REBOL] Re: 12-hour format
> mgkiourt wrote: > >
<<quoted lines omitted: 3>>
> to-12-hr: func [t [time!]] [ > if t/hour > 12 [t/hour: t/hour - 12] Compiling your code I
receive: Invalid word --hour>12 Any corrections?

 [6/6] from: al:bri:xtra at: 6-Oct-2001 7:31


Mike wrote:
> > if t/hour > 12 [t/hour: t/hour - 12] > Compiling your code I receive: Invalid word --hour>12 > Any corrections?
Remember that is rebol there *must* be a space around all operators. So instead of writing: t/hour>12 write: t/hour > 12 as Joel suggested earlier. I hope that helps! Andrew Martin ICQ: 26227169 http://valley.150m.com/

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