-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.9 (GNU/Linux)

owGbwMvMwCRor/UvqPLs4WbGNWZJkoZGRkaWJkYWFsaWRiZp6QXp8SW5BW6ZOake
TxYsTEwqzs8pLUnNqVQoykzPKNEDAi4urg43FgZBJgY2ViaQIgYuTgGYkSovGObX
9Yfd+O70sEwjd7Vq3Zq9R1/zy0cyLOj+LXBqzeMNqnK/7h/rqwpaHppVvw4A
=tzMr
-----END PGP MESSAGE-----
On Thu, Oct 2, 2008 at 3:37 PM, Jaka Jančar <[EMAIL PROTECTED]> wrote:

> Hi!
>
> MySQL (and probably others) has the following date/time types:
>  - TIME
>  - DATE
>  - DATETIME
>  - TIMESTAMP
>
> They each serve their purpose and are not redundant. Timestamp represents
> an exact point in time. The others represent floating times, days, or times
> within days.
>
> XML Schema also has a similar concept, where a dateTime (and therefore date
> and time) can be timezoned or not.
>
> Zend_Date supports only timestamps. I like it that there is only one class,
> for simplicity, but perhaps some properties like
>  - hasDate,
>  - hasTime and
>  - hasTimezone ( == !floating)
> could be added and behavour of various functions (such as those for
> comparing dates) adjusted to take these into account.
>
> What do you think?
>
>
> (longer explanation:)
> Why is this needed?
>
> Take, for example you want to store someone's birthday. Say it's
> 1987-01-01. If you store it using Zend_Date, it becomes 1987-01-01 00:00 in
> your current timezone (+02:00, for example).
>
> But the person most likely wasn't born at midnight, so, first of all, this
> is semantically incorrect.
>
> There are also more practical problems. Say another user from another
> timezone wants to see this person's birthday. If his timezone is +00:00
> he'll see 1986-12-31 22:00, which is obviously incorrect.
>
> To get around this, you'd have to:
>  - save Zend_Date's in UTC (or some other time zone) and remember to ignore
> the timezone (== use the same one as when saving) when displaying them and
>  - don't show the time, since it's meaningless.
>
> If Zend_Date supported the options suggested above, you'd just set
> hasDate=true, hasTime=false and hasTimezone=false, to get a floating date.
>
>
>
>


-- 
Nilesh Govindrajan ([EMAIL PROTECTED])

iTech7 Site and Server Administrator

www.itech7.com

Reply via email to