Zend Framework

setweekday() parameters rule does not same as display rule

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.0.3
  • Component/s: Zend_Date
  • Labels:
    None

Description

Zend_Date to array or display the Weekday, always consider the Sunday is '0',
but setweekday() consider Sunday is '7'.

would that can be the same rule ?

Activity

Hide
Thomas Weidner added a comment -

I dont really understand your problem...

setWeekday uses WEEKDAY_8601... the ISO format... ISO defines 1 as Montag and 7 as Sunday.
All setxxx functions work with ISO format.
getWeekday returns a DATE OBJECT and no string.

The ordinary toArray function returns the date as array where the weekday is treated as WEEKDAY_DIGIT which is like PHP's 'w' token.

Btw:
When you give an array as input the weekday is used as WEEKDAY_DIGIT like with toArray.

Show
Thomas Weidner added a comment - I dont really understand your problem... setWeekday uses WEEKDAY_8601... the ISO format... ISO defines 1 as Montag and 7 as Sunday. All setxxx functions work with ISO format. getWeekday returns a DATE OBJECT and no string. The ordinary toArray function returns the date as array where the weekday is treated as WEEKDAY_DIGIT which is like PHP's 'w' token. Btw: When you give an array as input the weekday is used as WEEKDAY_DIGIT like with toArray.
Hide
Liber Chen added a comment -

Yes, that's the point. ISO weekday is not used as PHP's.

Show
Liber Chen added a comment - Yes, that's the point. ISO weekday is not used as PHP's.
Hide
Thomas Weidner added a comment -

Sorry... I still don't see the problem.

Input format's always differ depending on the way you use...
As already said:
Array = GNU Format
setXX = ISO Format
getXX = Date Object

ISO defines 1 as monday and 7 as sunday
GNU defines 0 as sunday and 6 as saturday

We can't say that 7 is ok for GNU format and we can also not say that 0 is ok for ISO.
These rules are defined through the standards.

Show
Thomas Weidner added a comment - Sorry... I still don't see the problem. Input format's always differ depending on the way you use... As already said: Array = GNU Format setXX = ISO Format getXX = Date Object ISO defines 1 as monday and 7 as sunday GNU defines 0 as sunday and 6 as saturday We can't say that 7 is ok for GNU format and we can also not say that 0 is ok for ISO. These rules are defined through the standards.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: