This function should accomplish what you're looking for.
time-meridian: func [
time-data [time!]
][
either time-data/hour < 12 [
meridian-time: rejoin [time-data/hour ":" time-data/minute " a.m. EST"]
][
meridian-time: rejoin [time-data/hour ":" time-data/minute " p.m. EST"]
]
]
USAGE:
>> time-meridian now/time
== "10:57 a.m. EST"
-Ryan
>
>
> how do I format dates to am/pm format
> like: "hh:mm pm EST"
>
> is there a more succinct way to write this?
>
> time-ampm: func [ dt ]
> [ rejoin [
>
> ; handle hh:mm part
> ( replace ( copy/part (
> rejoin [
> (either dt/time < 10:00 [ "0" ] [ "" ]) ; hh:mm vs [h]h:mm
> either dt/time > 12:59:59
> [ mold dt/time - 12:00 ]
> [ mold dt/time ]
> ]
> ) 5 ) "00:" "12:" ) ; midnite-1am is special
>
>
> ; handle " pm EST" parts
> either dt/time > 11:59:59
> [ " pm" ]
> [ " am" ]
>
> " EST"
> ]]
>
> yes this does the job, perhaps a mold could be factored out
> and some parens are not needed. now the challenge
> is to write something that handles the exceptions
> with less code. this version allows coding by deletion
> since the two parts hh:mm vs am/pm indicator
> are treated separately and simply concatenated.
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.