source1ben
Posts: 32 Joined: Fri Nov 02, 2001 10:22 am
Post
by source1ben » Fri Mar 08, 2002 11:05 am
I'm trying to get the Day-Number-of-the-Week. I'm not having any luck with my attempts.
Here is my code.
<strfmt "%w" "now">
<$daynumber = $ret>
daynumber: $daynumber
I get the following error " Too many arguments for <strfmt> string"
My code works fine with a capital W, but I'm not looking for the Day-Number-of-the-Month.
Any ideas ?
mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Fri Mar 08, 2002 12:38 pm
The proper way to print times is with %t , then your time format. Some time formats that don't conflict with other things are "auto" recognized, but it's not good practice to rely on that. Use
<strfmt "%at" "%w" "now">
source1ben
Posts: 32 Joined: Fri Nov 02, 2001 10:22 am
Post
by source1ben » Fri Mar 08, 2002 1:04 pm
Works like a charm.
thx.
Ben
John
Site Admin
Posts: 2623 Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Post
by John » Fri Mar 08, 2002 1:41 pm
Note also that this is available as the SQL function dayofweek(), allowing SQL statements such as:
SELECT dayofweek(Date) from ....
and Vortex such as:
<$daynumber=(dayofweek( 'now' ))>
John Turnbull
Thunderstone Software
source1ben
Posts: 32 Joined: Fri Nov 02, 2001 10:22 am
Post
by source1ben » Fri Mar 08, 2002 1:48 pm
FYI- I get different results from the two different version of the code.
<strfmt "%at" "%w" "now">
returns: 5
<$daynumber=(dayofweek( 'now' ))>
returns: 6
Either method will solve my problem. Thx again.
mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Fri Mar 08, 2002 3:16 pm
fmt "days" range is 0-6 (a programming standard), dayofweek() range is 1-7 (a SQL standard).