Is there a way?
[1/7] from: kpeters:otaksoft at: 10-Dec-2007 18:06
>> now/date/year
** Script Error: Too many refinements
** Where: halt-view
** Near: now/date/year
>> t: now/date
== 10-Dec-2007
>> t/1
== 2007
>> t/year
== 2007
Is there a way to get the "elements" of the date without having
to resort to the introduction of an extra word?
TIA,
Kai
[2/7] from: pwawood::gmail::com at: 11-Dec-2007 10:13
>> now/year
== 2007
>> now/month
== 12
>> now/day
== 11
>> now/time
== 10:10:12
>> now/time/precise
== 10:10:23.578
? now
USAGE:
NOW /year /month /day /time /zone /date /weekday /precise
DESCRIPTION:
Returns the current local date and time.
NOW is a native value.
REFINEMENTS:
/year -- Returns the year only.
/month -- Returns the month only.
/day -- Returns the day of the month only.
/time -- Returns the time only.
/zone -- Returns the time zone offset from GMT only.
/date -- Returns date only.
/weekday -- Returns day of the week as integer (Monday is day 1).
/precise -- Use nanosecond precision
Peter
On 11/12/2007, Kai Peters <kpeters-otaksoft.com> wrote:
[3/7] from: Izkata:Comcast at: 10-Dec-2007 20:15
Here you go:
>> first now/date
== 2007
>> second now/date
== 12
>> third now/date
== 10
I don't like it, since it can feel ambiguous ('first being year, while
dates display with the year last, for example), but it works.
On Mon, 2007-12-10 at 18:06 -0800, Kai Peters wrote:
[4/7] from: carl:cybercraft at: 11-Dec-2007 7:53
On Monday, 10-December-2007 at 20:15 Izkata wrote,
>Here you go:
>>> first now/date
<<quoted lines omitted: 5>>
>I don't like it, since it can feel ambiguous ('first being year, while
>dates display with the year last, for example), but it works.
REBOL will accept dates with the year first...
>> 2007-12-11
== 11-Dec-2007
It's just that they decided the default output should be in a more-or-less standard format.
And I think it's right that under the hood the first value should be the most significant
number, same as with time.
-- Carl Read.
[5/7] from: petr::krenzelok::seznam::cz at: 11-Dec-2007 8:21
well, not sure if helpful, but following comes to mind:
>> parse to-string now "-/"
== ["11" "Dec" "2007" "8:20:20+1:00"]
cheers,
-pekr-
[6/7] from: petr::krenzelok::seznam::cz at: 11-Dec-2007 9:01
Petr Krenzelok napsal(a):
> well, not sure if helpful, but following comes to mind:
>
> >> parse to-string now "-/"
> == ["11" "Dec" "2007" "8:20:20+1:00"]
>
answering to myself - a little bit refined version :-)
>> parse to-string now "-/+"
== ["11" "Dec" "2007" "9:00:31" "1:00"]
-pekr-
[7/7] from: Karim::elfounas::easybraine::com at: 11-Dec-2007 15:34
Hello.
This works :
>> now/year
== 2007
>> now/month
== 12
>> now/day
== 11
(rebol view windows)
Kai Peters <kpeters-otaksoft.com> a =E9crit :
>>> now/date/year
> ** Script Error: Too many refinements
<<quoted lines omitted: 13>>
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
--
Karim EL FOUNAS
EasyBraine SA
Campagne des Rites, 8 - 1421 Ophain Bois-Seigneur-Isaac
Tel: +32 (0)2 387 32 34 - Mobile: +32 (0)495 57 32 34
karim.elfounas-easybraine.com - www.easybraine.com
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted