Re: [fw-general] Zend_Date Behavior: PEBKAC or Bug?

2011-03-03 Thread Ryan Lange
On Wed, Mar 2, 2011 at 10:56 PM, Simon Walter si...@gikaku.com wrote:

 On Thursday, March 03, 2011, Ryan Lange wrote:
[date_format] = string(5) d.M.y

 I may be very very wrong about this, but wouldn't that be allowing a single
 digit for for any of the date parts?

 Here is what I read:
 M   Month, one or two digit
 d   Day of the month, one or two digit
 y   Year, at least one digit

 Maybe you should be doing:
 dd.MM.

 Maybe you could use a constant, and that will help with localization:
 Zend_Date::DATE_SHORT


That doesn't seem to make a difference. A format of dd.MM. should fail
to parse 29.2.2008, but it doesn't. Similarly, a year part of y, yy,
or  all produce the same result (a successful parsing), whether the
year part of the input is 08 or 2008.

It seems that the format is only good for hinting at the order of the parts
in the input and not the overall format of the input or even the size of the
parts.


Ryan


Re: [fw-general] Zend_Date Behavior: PEBKAC or Bug?

2011-03-02 Thread Simon Walter
On Thursday, March 03, 2011, Ryan Lange wrote:
   [date_format] = string(5) d.M.y

I may be very very wrong about this, but wouldn't that be allowing a single 
digit for for any of the date parts?

Here is what I read:
M   Month, one or two digit
d   Day of the month, one or two digit
y   Year, at least one digit

Maybe you should be doing:
dd.MM.

Maybe you could use a constant, and that will help with localization: 
Zend_Date::DATE_SHORT



Re: [fw-general] [Zend_Date] Sunday weekday 0 / 7

2010-08-22 Thread Jigal sanders
Hi,

I don't know if it is an elegant option but what you could do
is $zfDate-setWeekday($weekday+1);

On Sun, Aug 22, 2010 at 1:31 AM, debussy007 debussy...@gmail.com wrote:


 Hi,

 I have stored a schedule in database, which contains weekdays and time
 slots.

 I want to create a date and set the weekday :

 $zfDate = new Zend_Date();
 $zfDate-setWeekday($weekday);

 The problem is when the weekday is 0, I got an exception, it only accepts
 weekdays from 1 to 7. How do I specify to use weekdays from 0 to 6 as they
 are stored in my DB ? (I don't want 7 to be Sunday but rather 0).

 I tried the following :

 $zfDate = new Zend_Date(NULL, NULL, new Zend_Locale('en_US'));

 But it didn't work.

 Thank you for any help !
 --
 View this message in context:
 http://zend-framework-community.634137.n4.nabble.com/Zend-Date-Sunday-weekday-0-7-tp2333881p2333881.html
 Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] [Zend_Date] Sunday weekday 0 / 7

2010-08-22 Thread Ben Scholzen
Am 22.08.2010 01:31, schrieb debussy007:
 
 Hi,
 
 I have stored a schedule in database, which contains weekdays and time
 slots.
 
 I want to create a date and set the weekday :
 
 $zfDate = new Zend_Date();
 $zfDate-setWeekday($weekday);

Just do:

$zfDate-setWeekday($weekday % 7);

 The problem is when the weekday is 0, I got an exception, it only accepts
 weekdays from 1 to 7. How do I specify to use weekdays from 0 to 6 as they
 are stored in my DB ? (I don't want 7 to be Sunday but rather 0).
 
 I tried the following :
 
 $zfDate = new Zend_Date(NULL, NULL, new Zend_Locale('en_US'));
 
 But it didn't work.
 
 Thank you for any help !


-- 
Ben Scholzen 'DASPRiD'
Community Review Team Member | m...@dasprids.de
Zend Framework   | http://www.dasprids.de
PGP key: http://stuff.dasprids.de/pgp/ben-scholzen-pgp-key.asc


Re: [fw-general] Zend_Date get('Y-m-d') bug?

2010-04-17 Thread Jurian Sluiman
On Saturday 17 Apr 2010 13:40:43 András Csányi wrote:
 Hi all!
 
 I want to know what is the date of the first day of the week. I did this:
 $currDate = new Zend_Date();
 $currDate-sub($currDate-get(Zend_Date::WEEKDAY_DIGIT)-
 1,Zend_Date::DAY); var_dump($currDate-get('Y-m-d'));
 
 But, the result is not so good. The year and the day is good. The
 month is replaced to minutes.
 2010-38-12; actual time here: 13:38
 
 I watched in the documentation and it should be good.
 (http://hu.php.net/manual/en/function.date.php)
 
 If I get the date through __toString() good, but I want to avoid
 formatting the string.
 
 Did I somethign wrong?
 
 Thanks for the help!

No its' not a bug, you're using the minute constant. A capital M is the 
constant for the month.

The Zend_Date constants differ from the php constants. Visit the documentation 
for more information: 
http://framework.zend.com/manual/en/zend.date.constants.html and specific the 
section Self-Defined OUTPUT Formats with ISO

Regards, Jurian
-- 
Jurian Sluiman
CTO Soflomo V.O.F.
http://soflomo.com


Re: [fw-general] Zend_Date get('Y-m-d') bug?

2010-04-17 Thread till
On Sat, Apr 17, 2010 at 1:46 PM, Jurian Sluiman
subscr...@juriansluiman.nl wrote:
 On Saturday 17 Apr 2010 13:40:43 András Csányi wrote:
 Hi all!

 I want to know what is the date of the first day of the week. I did this:
 $currDate = new Zend_Date();
     $currDate-sub($currDate-get(Zend_Date::WEEKDAY_DIGIT)-
 1,Zend_Date::DAY); var_dump($currDate-get('Y-m-d'));

 But, the result is not so good. The year and the day is good. The
 month is replaced to minutes.
 2010-38-12; actual time here: 13:38

 I watched in the documentation and it should be good.
 (http://hu.php.net/manual/en/function.date.php)

 If I get the date through __toString() good, but I want to avoid
 formatting the string.

 Did I somethign wrong?

 Thanks for the help!

 No its' not a bug, you're using the minute constant. A capital M is the
 constant for the month.

 The Zend_Date constants differ from the php constants. Visit the documentation
 for more information:
 http://framework.zend.com/manual/en/zend.date.constants.html and specific the
 section Self-Defined OUTPUT Formats with ISO

 Regards, Jurian

The easiest way is still to do the following:
Zend_Date::setOptions(array('format_type' = 'php'));

... and then use PHP-like identifiers to do your date juggling.

Till


Re: [fw-general] Zend_Date get('Y-m-d') bug?

2010-04-17 Thread András Csányi
On 17 April 2010 14:03, till klimp...@gmail.com wrote:

 The easiest way is still to do the following:
 Zend_Date::setOptions(array('format_type' = 'php'));

 ... and then use PHP-like identifiers to do your date juggling.

It sounds like a title of a motivation picture. :)

-- 
- -
--  Csanyi Andras  -- http://sayusi.hu -- Sayusi Ando
--  Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell


Re: [fw-general] Zend_Date with Zend_Locale for en_SG

2010-03-26 Thread Thomas Weidner

The format you're using does not exist for en_SG.
According to ISO there are:
M/d/yy G
MMM d, y G
 d, y G
,  d, y G

But you gave
MM/dd/

So the expected format and the given format do not match.
When you are using a fixed format and no localized one, then use a fixed 
format definition.


new Zend_Date('26/03/2010', 'MM/dd/', 'en_SG');

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Chin Lee kwangc...@gmail.com

To: fw-general@lists.zend.com
Sent: Friday, March 26, 2010 5:53 AM
Subject: [fw-general] Zend_Date with Zend_Locale for en_SG




I have a calendar system to input date (eg. 26/03/2010) and I need
Zend_Date::isDate() with Zend_Locale to check whether the input date is in
correct format.

This system runs in Singapore so I set the Zend_Locale to 'en_SG' but the
problem comes. The Zend_Date::isDate() returns a false.

I have tried to google about the ISO date format for Singapore and found
that they are using day-month-year system (ref:
http://en.wikipedia.org/wiki/Calendar_date
http://en.wikipedia.org/wiki/Calendar_date )

Question: How do I have Zend_Date and Zend_Locale to work perfectly for
Singapore without modifying zf?
--
View this message in context: 
http://n4.nabble.com/Zend-Date-with-Zend-Locale-for-en-SG-tp1691708p1691708.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date::isWeekend()

2010-01-20 Thread Thomas Weidner

What do you want to archive?
And how do you define a weekend?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: takeshin admi...@gmail.com

To: fw-general@lists.zend.com
Sent: Wednesday, January 20, 2010 6:51 PM
Subject: [fw-general] Zend_Date::isWeekend()




How to implement this method?

$weekInfo = Zend_Locale_Data::getList($locale, 'week');

Is this the only way?

--
regards
takeshin


--
View this message in context: 
http://n4.nabble.com/Zend-Date-isWeekend-tp1018598p1018598.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date::isWeekend()

2010-01-20 Thread takeshin

I'm displaying a calendar.
One day by day.
My day is an instance of Zend_Date.
If a day is a weekend day, I want to display it in em

My definition of weekend days is that these the days between weekendStart
and WeekendEnd, 
as defined in Zend_Locale_Data['week']

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-isWeekend-tp1018598p1018640.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date::MONTH_NAME stand-alone

2010-01-20 Thread Thomas Weidner

format/wide is used when a string has to be displayed within a date format.

stand-alone/wide should only be used when a string is used independently 
from a format for example within a translation.


Therefor Zend_Date will never use the standalone format as dates are always 
based on a format and not be displayed stand-alone.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: takeshin admi...@gmail.com

To: fw-general@lists.zend.com
Sent: Wednesday, January 20, 2010 7:01 PM
Subject: [fw-general] Zend_Date::MONTH_NAME stand-alone



I want to display a current month name in Polish language.
So I use Zend_Date::get(Zend_Date::MONTH_NAME);
but it displays 'stycznia' (specified in Zend_Locale_Data .. format/wide)

What I really should display is 'styczeń',
specified in Zend_Locale_Data .. stand-alone/wide

Is it intended, or a bug?
How to get current date this 'stand-alone' format?
Zend_Date::get(Zend_Date::MONTH_NAME_STAND_ALONE);


BTW,
How to get specific key of the array retrieved by this:
Zend_Locale_Data::getList('pl', 'months');
XPath expressions are allowed? mon...@?

--
regards
takeshin
--
View this message in context: 
http://n4.nabble.com/Zend-Date-MONTH-NAME-stand-alone-tp1018609p1018609.html
Sent from the Zend Framework mailing list archive at Nabble.com. 



Re: [fw-general] Zend_Date::isWeekend()

2010-01-20 Thread Thomas Weidner

Then use this information by comparing it with getWeekday().

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: takeshin admi...@gmail.com

To: fw-general@lists.zend.com
Sent: Wednesday, January 20, 2010 7:45 PM
Subject: Re: [fw-general] Zend_Date::isWeekend()




I'm displaying a calendar.
One day by day.
My day is an instance of Zend_Date.
If a day is a weekend day, I want to display it in em

My definition of weekend days is that these the days between weekendStart
and WeekendEnd,
as defined in Zend_Locale_Data['week']

--
regards
takeshin
--
View this message in context: 
http://n4.nabble.com/Zend-Date-isWeekend-tp1018598p1018640.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date working with dates like '0000-00-00'

2010-01-18 Thread Thomas Weidner

You can enter such dates within Zend_Date and there will be no failure.
But Zend_Date will automatically correct this date and change it to
Year 0, Month Jannuary - 1, Day First - 1

Which should lead so something like -01.December.31 00:00:00.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Marcus Stöhr daf...@soundtrack-board.de

To: fw-general@lists.zend.com
Sent: Monday, January 18, 2010 11:36 AM
Subject: [fw-general] Zend_Date  working with dates like '-00-00'


Hi,

I'm using Zend_Date in combination with data from an MySQL-table. I often 
get the following date values from MySQL (due to schema changes made after 
the creation of the tables): -00-00 and -00-00 00:00


Can I work with them in Zend_Date like any other date or should I extend 
Zend_Date with my own class to handle these special cases?


- Marcus= 



Re: [fw-general] Zend_Date working with dates like '0000-00-00'

2010-01-18 Thread Thomas Weidner

Please write always to the mailinglist.

How dates are handles depends on the used locale.
See the manual for more informations on locales.

Example:
english is something like Month/Day/Year but german is Day/Month/Year.

As you can see depending on the used locale also the date you will get in 
return differs.


And as said before dates are always corrected.
So, when you select a month of 0 it's equal to the last month one year 
ago or year-1, Month 12


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Marcus Stöhr daf...@soundtrack-board.de

To: Thomas Weidner thomas.weid...@gmx.at
Sent: Monday, January 18, 2010 2:06 PM
Subject: Re: [fw-general] Zend_Date  working with dates like '-00-00'


Thank you, Thomas.

And there was another situation coming to mind: How does Zend_Date handle 
partial dates, e.g. 2010-01-00 or 2010-00-00?


- Marcus

Am 18.01.2010 um 12:47 schrieb Thomas Weidner:


You can enter such dates within Zend_Date and there will be no failure.
But Zend_Date will automatically correct this date and change it to
Year 0, Month Jannuary - 1, Day First - 1

Which should lead so something like -01.December.31 00:00:00.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Marcus Stöhr 
daf...@soundtrack-board.de

To: fw-general@lists.zend.com
Sent: Monday, January 18, 2010 11:36 AM
Subject: [fw-general] Zend_Date  working with dates like '-00-00'


Hi,

I'm using Zend_Date in combination with data from an MySQL-table. I often 
get the following date values from MySQL (due to schema changes made after 
the creation of the tables): -00-00 and -00-00 00:00


Can I work with them in Zend_Date like any other date or should I extend 
Zend_Date with my own class to handle these special cases?


- Marcus= 




Re: [fw-general] Zend_Date throwing Cache Exception

2009-12-18 Thread Hector Virgen
I'm not sure what's going on with Zend_Date, but as for the Cache resource,
here's a simple one I've put together:

?php

/**
 * Cache resource
 *
 * @author Hector Virgen
 */
class Default_Resource_Cache extends
Zend_Application_Resource_ResourceAbstract
{
 /**
 * Creates a cache and returns it
 *
 * @return Zend_Cache_Core
 */
 public function init()
 {
 $options = $this-getOptions();
 $cache = Zend_Cache::factory(
 $options['frontend'],
 $options['backend'],
 $options['frontendOptions'],
 $options['backendOptions']
 );
 return $cache;
 }
}


To use it, just add a few lines to your application.ini:

resources.cache.frontend = Core
resources.cache.backend = File
resources.cache.frontendOptions.lifetime = 7200
resources.cache.frontendOptions.automatic_serialization = true
resources.cache.backendOptions.cache_dir = APPLICATION_PATH /../data/cache

--
Hector


On Fri, Dec 18, 2009 at 11:44 AM, ma...@shqiperia.com wrote:

 Hello,

 Just wondering, why would a simple call on Zend_Date require Caching?

 I get:

 EXCEPTION INFORMATION:

 MESSAGE: Could not determine temp directory, please specify a cache_dir
 manually

 when I try to call new Zend_Date();

 The second question:
 Since Cache is not one in one of the Available Resource Pluginse what is
 the best way to initiate it, to avoid similar messages with Zend_Date or
 Zend_Locale.

 Thank you for your time,
 Armand




Re: [fw-general] Zend_Date throwing Cache Exception

2009-12-18 Thread mandi


Thank you very much Hector, 

I was also assisted from: 

http://www.zfsnippets.com/snippets/view/id/72/bootstrap-cache-resource 

There is a configuration line: 
/// use as default locale cache
 if (isset($options['isDefaultLocaleCache'])  
 }

which activates the Zend_Locale cache as well. 

Regards, 

Armand 

On Fri, 18 Dec 2009 11:54:51 -0800, Hector Virgen  wrote:  

I'm not sure what's going on with Zend_Date, but as for the Cache
resource, here's a simple one I've put together: 

 /**  * Cache resource  *  * @author Hector Virgen  */ class
Default_Resource_Cache extends Zend_Application_Resource_ResourceAbstract {
 /**   * Creates a cache and returns it   *   * @return Zend_Cache_Core  
*/  public function init()  {  $options = $this-getOptions();$cache =
Zend_Cache::factory(  $options['frontend'],  $options['backend'], 
$options['frontendOptions'],  $options['backendOptions']  );return
$cache;  } } 

 To use it, just add a few lines to your application.ini: 
 
resources.cache.frontend = Core resources.cache.backend = File
resources.cache.frontendOptions.lifetime = 7200
resources.cache.frontendOptions.automatic_serialization = true
resources.cache.backendOptions.cache_dir = APPLICATION_PATH
/../data/cache  
--
Hector

 On Fri, Dec 18, 2009 at 11:44 AM,  wrote:
 Hello,

 Just wondering, why would a simple call on Zend_Date require Caching?

 I get:

 EXCEPTION INFORMATION:

 MESSAGE: Could not determine temp directory, please specify a cache_dir
 manually

 when I try to call new Zend_Date();

 The second question:
 Since Cache is not one in one of the Available Resource Pluginse what
is
 the best way to initiate it, to avoid similar messages with Zend_Date or
 Zend_Locale.

 Thank you for your time,
 Armand



Links:
--
[1] mailto:ma...@shqiperia.com


Re: [fw-general] Zend_Date first day of the week

2009-12-09 Thread takeshin



Thomas Weidner wrote:
 
 It's a regional topic.
 For more informations look into unicodes database: 
 http://unicode.org/cldr


It a little bit off topic already :)

I'm interested in function like:

function getFirstDayOfTheWeek($country)
...
Of course, I can allow user to set this manually,
but I'm just looking for sane defaults.
 
 As written before it's all available within Zend_Locale when you look at
 the 
 token week.
 
 And as mentioned in past the first day of week is NOT related to a
 language 
 but to a region. So en would not work but US would.
 
 

Thank you Thomas.
Localization in ZF is great, indeed.

I've been looking in Zend_Locale and Zend_Date,
but the key was Zend_Locale_Data.

I wrote a function I needed:

/**
 * Get localized array of the weekdays, starting from the first day of
the week, depending on region
 *
 * @param string|Zend_Locale $locale Locale with region, e.g. pl_PL
 * @param string|int $format
 * @return array
 */
public function getWeekdays($locale, $format = null)
{
if (is_string($locale)) {
$locale = new Zend_Locale($locale);
}

$days = Zend_Locale_Data::getList($locale, 'days');

switch ($format) {
case 'abbreviated':
case Zend_Date::WEEKDAY_SHORT:
$daysDisplayed = $days['format']['abbreviated']; // Sun,
Mon, Tue
break;
case 'wide':
case Zend_Date::WEEKDAY_NAME:
$daysDisplayed = $dayInfo['format']['wide']; // Sunday,
Monday, Tuesday
break;
case 'narrow':
case Zend_Date::WEEKDAY_NARROW:
$daysDisplayed = $dayInfo['stand-alone']['narrow']; // S, M,
T,
break;
default:
$daysDisplayed = $dayInfo['stand-alone']['narrow']; // 
}

$weekInfo = Zend_Locale_Data::getList($locale, 'week');
$firstDayAbbr = $weekInfo['firstDay'];
$firstDayNr = (int)$days['format']['narrow'][$firstDayAbbr];

for ($i=1; $i$firstDayNr; $i++) {
$e = array_shift($daysDisplayed);
array_push($daysDisplayed, $e);
}

return array_values($daysDisplayed);
}

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p956558.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date first day of the week

2009-12-08 Thread Thomas Weidner

It's a regional topic.
For more informations look into unicodes database: 
http://unicode.org/cldr




It a little bit off topic already :)

I'm interested in function like:

function getFirstDayOfTheWeek($country)
...
Of course, I can allow user to set this manually,
but I'm just looking for sane defaults.


As written before it's all available within Zend_Locale when you look at the 
token week.


And as mentioned in past the first day of week is NOT related to a language 
but to a region. So en would not work but US would.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com 



[fw-general] R: Re: [fw-general] Zend_Date first day of the week

2009-12-08 Thread acazzaniga
I think 0 is sunday.. 1 is monday .. 
--Messaggio originale--
Da: takeshin
A:fw-general@lists.zend.com
Oggetto: Re: [fw-general] Zend_Date first day of the week
Inviato: 8 Dic 2009 00:27




Thomas Weidner wrote:
 
 
 It is possible.
 But your expectations are wrong. ;-)
 
 

No comprendo, Senior ;)


Thomas Weidner wrote:
 
 It's a regional topic.
 For more informations look into unicodes database: http://unicode.org/cldr
 
 

It a little bit off topic already :)

I'm interested in function like:

function getFirstDayOfTheWeek($country)
{

switch ($coutry) {
case 'pl':
case 'de':
case 'cz':
case other... (where to find the other?)
   return 1;
case some arabic…
case some jewish…
   return 6;
case some exotic ones:
   return (2 ÷ 5)
…
default:
 return 0;
}

}

Of course, I can allow user to set this manually,
but I'm just looking for sane defaults.

-- 
regards
takeshin

-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954854.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Sent from my BlackBerry® wireless device

Re: [fw-general] R: Re: [fw-general] Zend_Date first day of the week

2009-12-08 Thread Thomas Weidner

No it's not... simply read what was written before in this post.
0 is sunday for italy or united states. But it's not for egypt or oman for 
example.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: acazzan...@fastwebnet.it

To: fw-general@lists.zend.com
Sent: Tuesday, December 08, 2009 1:45 AM
Subject: [fw-general] R: Re: [fw-general] Zend_Date first day of the week



I think 0 is sunday.. 1 is monday ..
--Messaggio originale--
Da: takeshin
A:fw-general@lists.zend.com
Oggetto: Re: [fw-general] Zend_Date first day of the week
Inviato: 8 Dic 2009 00:27




Thomas Weidner wrote:



It is possible.
But your expectations are wrong. ;-)




No comprendo, Senior ;)


Thomas Weidner wrote:


It's a regional topic.
For more informations look into unicodes database: 
http://unicode.org/cldr





It a little bit off topic already :)

I'm interested in function like:

function getFirstDayOfTheWeek($country)
{

switch ($coutry) {
case 'pl':
case 'de':
case 'cz':
case other... (where to find the other?)
  return 1;
case some arabic…
case some jewish…
  return 6;
case some exotic ones:
  return (2 ÷ 5)
…
default:
return 0;
}

}

Of course, I can allow user to set this manually,
but I'm just looking for sane defaults.

--
regards
takeshin

--
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954854.html

Sent from the Zend Framework mailing list archive at Nabble.com.


Sent from my BlackBerry® wireless device 




Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread takeshin



vince. wrote:
 
 Try:
 
 date_default_timezone_set('Europe/Berlin');
 $date = new Zend_Date();
 
 // Output of the current timestamp
 print $date;
 print br /;
 print $date-get(Zend_Date::WEEKDAY);
 

Thanks.
I Always forget to set correct timezone…

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954196.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread takeshin

Sorry, but this is not what's I'm asking for.

The question is how to get first day of the week for the specified timezone,
which returns *always* 0 (Sunday) for America
and *always* 1 (Monday) for Poland.

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954215.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread Thomas Weidner

$date-getWeekday(0);

Note that NOT EVERY COUNTRY defines 0 to be sunday... it depends on the 
country if 0 is a sunday or another day.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: takeshin admi...@gmail.com

To: fw-general@lists.zend.com
Sent: Monday, December 07, 2009 9:51 AM
Subject: Re: [fw-general] Zend_Date first day of the week




Sorry, but this is not what's I'm asking for.

The question is how to get first day of the week for the specified 
timezone,

which returns *always* 0 (Sunday) for America
and *always* 1 (Monday) for Poland.

--
regards
takeshin
--
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954215.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread takeshin

W dniu 2009-12-07 10:33, Thomas Weidner [via Zend Framework Community] 
pisze:
 $date-getWeekday(0);

 Note that NOT EVERY COUNTRY defines 0 to be sunday... it depends on the
 country if 0 is a sunday or another day.


Thank you. That's all in the manual.

But, simply put:
How to determine this is '0' should be 0 or other value for specified 
locale?

I thought that Zend_Date might provide this information.

I'm creating a calendar. It would be nice, if calendar looked like this:

// for english speaking users
Zend_Locale::setLocale('en');
(0)Sunday, (1)Monday, (2)Tuesday, (3)Wednesday …

// for German speaking users
Zend_Locale::setLocale('de');
(1)Montag, (2)Dienstag, (3)Mittwoch, (4)Donnerstag…

//
Zend_Locale::setLocale('pl');
(1)Poniedziałek, (2)Wtorek, (3)Środa, (4)Czwartek…

-- 
regards
takeshin





-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954403.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread Thomas Weidner


- Original Message - 
From: takeshin admi...@gmail.com

To: fw-general@lists.zend.com
Sent: Monday, December 07, 2009 3:25 PM
Subject: Re: [fw-general] Zend_Date first day of the week




$date-getWeekday(0);

Note that NOT EVERY COUNTRY defines 0 to be sunday... it depends on the
country if 0 is a sunday or another day.



Thank you. That's all in the manual.


Why have you asked when you knew it and all is within the manual ??


But, simply put:
How to determine this is '0' should be 0 or other value for specified
locale?


Don't rely on 0...
As said 0 can be sunday or saturday or monday.
But monday is always monday.


I thought that Zend_Date might provide this information.


It does.


I'm creating a calendar. It would be nice, if calendar looked like this:

// for english speaking users
Zend_Locale::setLocale('en');
(0)Sunday, (1)Monday, (2)Tuesday, (3)Wednesday …

// for German speaking users
Zend_Locale::setLocale('de');
(1)Montag, (2)Dienstag, (3)Mittwoch, (4)Donnerstag…

//
Zend_Locale::setLocale('pl');
(1)Poniedziałek, (2)Wtorek, (3)Środa, (4)Czwartek…


As said before:
Don't rely on 0 being Sunday.
The 7.December.2009 is always monday regardless of the locale or if the used 
calendar format defines 0 to be sunday.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com 



Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread A.J. Brown
I think his question is:

How do I determine (automagically) what the first day of the week is,
for a given LOCALE?

I think he wants something like this:

Zend_Locale::setLocale( LOCALE );
Zend_Date::getFirstWeekday(); // returns 0 for Americas, 1 for Germany



On Mon, Dec 7, 2009 at 11:07 AM, Thomas Weidner thomas.weid...@gmx.at wrote:

 - Original Message - From: takeshin admi...@gmail.com
 To: fw-general@lists.zend.com
 Sent: Monday, December 07, 2009 3:25 PM
 Subject: Re: [fw-general] Zend_Date first day of the week



 $date-getWeekday(0);

 Note that NOT EVERY COUNTRY defines 0 to be sunday... it depends on the
 country if 0 is a sunday or another day.


 Thank you. That's all in the manual.

 Why have you asked when you knew it and all is within the manual ??

 But, simply put:
 How to determine this is '0' should be 0 or other value for specified
 locale?

 Don't rely on 0...
 As said 0 can be sunday or saturday or monday.
 But monday is always monday.

 I thought that Zend_Date might provide this information.

 It does.

 I'm creating a calendar. It would be nice, if calendar looked like this:

 // for english speaking users
 Zend_Locale::setLocale('en');
 (0)Sunday, (1)Monday, (2)Tuesday, (3)Wednesday ...

 // for German speaking users
 Zend_Locale::setLocale('de');
 (1)Montag, (2)Dienstag, (3)Mittwoch, (4)Donnerstag...

 //
 Zend_Locale::setLocale('pl');
 (1)Poniedziałek, (2)Wtorek, (3)Środa, (4)Czwartek...

 As said before:
 Don't rely on 0 being Sunday.
 The 7.December.2009 is always monday regardless of the locale or if the used
 calendar format defines 0 to be sunday.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com




-- 
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969


Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread takeshin



A.J. Brown-3 wrote:
 
 I think his question is:
 
 How do I determine (automagically) what the first day of the week is,
 for a given LOCALE?
 
 I think he wants something like this:
 
 Zend_Locale::setLocale( LOCALE );
 Zend_Date::getFirstWeekday(); // returns 0 for Americas, 1 for Germany
 

Yes. Thank you for helping me to precise the question.
Sorry for not being eloquent enough.

Correct me if I'm wrong,
but I think it's currently not possible with Zend_Date.

I looked into Zend/Locale/Data xmls,
but among lots of options there is no: firstWorkDayOfTheWeek
or anything similar to this.

BTW, Is it cultural / religion related/ local law  related topic?
For instance, see this article: http://www.cjvlang.com/Dow/SunMon.html

-- 
regards
takeshin

-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954773.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread Thomas Weidner


- Original Message - 
From: takeshin admi...@gmail.com

To: fw-general@lists.zend.com
Sent: Monday, December 07, 2009 10:31 PM
Subject: Re: [fw-general] Zend_Date first day of the week






A.J. Brown-3 wrote:


I think his question is:

How do I determine (automagically) what the first day of the week is,
for a given LOCALE?

I think he wants something like this:

Zend_Locale::setLocale( LOCALE );
Zend_Date::getFirstWeekday(); // returns 0 for Americas, 1 for Germany



Yes. Thank you for helping me to precise the question.
Sorry for not being eloquent enough.

Correct me if I'm wrong,
but I think it's currently not possible with Zend_Date.


It is possible.
But your expectations are wrong. ;-)


I looked into Zend/Locale/Data xmls,
but among lots of options there is no: firstWorkDayOfTheWeek
or anything similar to this.


Then take a deeper look into week.


BTW, Is it cultural / religion related/ local law  related topic?
For instance, see this article: http://www.cjvlang.com/Dow/SunMon.html


It's a regional topic.
For more informations look into unicodes database: http://unicode.org/cldr

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


Re: [fw-general] Zend_Date first day of the week

2009-12-07 Thread takeshin



Thomas Weidner wrote:
 
 
 It is possible.
 But your expectations are wrong. ;-)
 
 

No comprendo, Senior ;)


Thomas Weidner wrote:
 
 It's a regional topic.
 For more informations look into unicodes database: http://unicode.org/cldr
 
 

It a little bit off topic already :)

I'm interested in function like:

function getFirstDayOfTheWeek($country)
{

switch ($coutry) {
case 'pl':
case 'de':
case 'cz':
case other... (where to find the other?)
   return 1;
case some arabic…
case some jewish…
   return 6;
case some exotic ones:
   return (2 ÷ 5)
…
default:
 return 0;
}

}

Of course, I can allow user to set this manually,
but I'm just looking for sane defaults.

-- 
regards
takeshin

-- 
View this message in context: 
http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954854.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Date first day of the week

2009-12-06 Thread Vadim Gabriel
Hi,

Try:

date_default_timezone_set('Europe/Berlin');
$date = new Zend_Date();

// Output of the current timestamp
print $date;
print br /;
print $date-get(Zend_Date::WEEKDAY);

On Mon, Dec 7, 2009 at 9:15 AM, takeshin admi...@gmail.com wrote:


 Is it possible to get first day of the week
 for the specified locale using Zend_Date?
 Zend_Date::WEEKDAY_FIRST ?

 --
 regards
 takeshin
 --
 View this message in context:
 http://n4.nabble.com/Zend-Date-first-day-of-the-week-tp954180p954180.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.
Zend Framework Certified Engineer.
-- Email: vadim...@gmail.com
-- Phone: +972-52-3808258
-- Website: http://www.vadimg.com


Re: [fw-general] Zend_Date problem

2009-11-11 Thread Thomas Weidner

Creating the instance affects the timezone.
Using set methods affect the timezone.
The manual states multiple ways (more than 20?) to affect the timezone.

In the code you gave the locale affects the timezone.
And we still don't know how your complete date looks like.
So all we can do is prediction.

And using your code on both locales I get:
sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
en_GB:string '2009-10-22T10:01:36+02:00' (length=25)

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Саша Стаменковић umpir...@gmail.com

To: Thomas Weidner thomas.weid...@gmx.at
Cc: fw-general@lists.zend.com
Sent: Wednesday, November 11, 2009 8:47 AM
Subject: Re: [fw-general] Zend_Date problem


How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner 
thomas.weid...@gmx.atwrote:


Sorry, but date_default_timezone_set has no effect on the timezone which 
is

actually used by the instance of Zend_Date nor has it effect on DST.
My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving
partitial informations ?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Саша Стаменковић umpir...@gmail.com
To: kobsu ko...@iki.fi
Cc: fw-general@lists.zend.com
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem



@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu ko...@iki.fi wrote:



Try
Zend_Date::setOptions(array('fix_dst' = true));

before
$date = new Zend_Date();


umpirsky wrote:

 Hi zf community.

 This code:

 $date = new Zend_Date(null, null, $locale);
 $date-setTimestamp(1256198496);
 echo $date-getDate()-toString(Zend_Date::DATES);

 gives date 21.10.2009. for sr_RS locale (similar for other locales), 
 for

 en_GB it gives 21 Oct 2009.
 I expect 22 Oct 2009. it's whole day missed?!?!?

 Any idea?


--
View this message in context:
http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
Sent from the Zend Framework mailing list archive at Nabble.com.









Re: [fw-general] Zend_Date problem

2009-11-11 Thread Саша Стаменковић
Looks like you didn't use my piece of code to reproduce the problem:

$date = new Zend_Date(null, null, $locale);
$date-setTimestamp(1256198496);
echo $date-getDate()-toString(Zend_Date::DATES);

Using this:

$date = new Zend_Date(null, null, $locale);
$date-setTimestamp(1256198496);
echo $date-getDate()-toString();

I get

21 Oct 2009 23:00:00

which is again wrong.

If I understand well, Zend_Date is determining which timezone to use by
locale passed in constructor. But by looking in constructor docblock I
figured that it's read from PHP

/**
 * Generates the standard date object, could be a unix timestamp,
localized date,
 * string, integer, array and so on. Also parts of dates or time are
supported
 * Always set the default timezone:
http://php.net/date_default_timezone_set
 * For example, in your bootstrap:
date_default_timezone_set('America/Los_Angeles');
 * For detailed instructions please look in the docu.
 *
 * @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
or value of date part to set
 * ,depending on $part.
If null the actual time is set
 * @param  string  $partOPTIONAL Defines the
input format of $date
 * @param  string|Zend_Locale  $locale  OPTIONAL Locale for
parsing input
 * @return Zend_Date
 * @throws Zend_Date_Exception
 */
public function __construct($date = null, $part = null, $locale = null)

and in line #184 it's obvious

// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this-setTimezone($zone);

I use zf 1.9.5.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Creating the instance affects the timezone.
 Using set methods affect the timezone.
 The manual states multiple ways (more than 20?) to affect the timezone.

 In the code you gave the locale affects the timezone.
 And we still don't know how your complete date looks like.
 So all we can do is prediction.

 And using your code on both locales I get:
 sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
 en_GB:string '2009-10-22T10:01:36+02:00' (length=25)


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Саша Стаменковић umpir...@gmail.com
 To: Thomas Weidner thomas.weid...@gmx.at

 Cc: fw-general@lists.zend.com
 Sent: Wednesday, November 11, 2009 8:47 AM

 Subject: Re: [fw-general] Zend_Date problem


 How do I set timezone to affect Zend_Date component?
 I use zend date to create view helper for date formatting.

 Regards,
 Saša Stamenković


 On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Sorry, but date_default_timezone_set has no effect on the timezone which
 is
 actually used by the instance of Zend_Date nor has it effect on DST.
 My question was related to the instance not your environment.

 Why don't you output all dateparts from the instance instead of giving
 partitial informations ?

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Саша Стаменковић umpir...@gmail.com
 
 To: kobsu ko...@iki.fi
 Cc: fw-general@lists.zend.com
 Sent: Wednesday, November 11, 2009 7:59 AM
 Subject: Re: [fw-general] Zend_Date problem



 @Thomas Weidner
 *
 *
 date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

 @kobsu
 *
 *
 *Same result :(
 *
 Regards,
 Saša Stamenković


 On Tue, Nov 10, 2009 at 6:20 PM, kobsu ko...@iki.fi wrote:


  Try
 Zend_Date::setOptions(array('fix_dst' = true));

 before
 $date = new Zend_Date();


 umpirsky wrote:
 
  Hi zf community.
 
  This code:
 
  $date = new Zend_Date(null, null, $locale);
  $date-setTimestamp(1256198496);
  echo $date-getDate()-toString(Zend_Date::DATES);
 
  gives date 21.10.2009. for sr_RS locale (similar for other locales), 
 for
  en_GB it gives 21 Oct 2009.
  I expect 22 Oct 2009. it's whole day missed?!?!?
 
  Any idea?
 

 --
 View this message in context:
 http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
 Sent from the Zend Framework mailing list archive at Nabble.com.








Re: [fw-general] Zend_Date problem

2009-11-11 Thread Thomas Weidner

Looks like you didn't use my piece of code to reproduce the problem:


Look like you did not output all date parts.
Why should I use your code when it's obviously wrong ?

You set the actual date with time, timezone and DST.
F.e. 2009-11-11 05:00:00+02:00

Then you set a timestamp overwriting the previous date and time but leaving 
timezone and DST.

This leads to 2009-10-22 10:01:36+02:00.

Then you cut of the time from the instance but still using DST.

Reason:
You used getDate - this strips the time and returns ONLY date
2009-10-22 10:01:36+02:00 - before
2009-10-22 00:00:00 (+02:00-trunking time internally by getDate())
2009-10-21 22:00:00 (+00:00- trunking timezone and DST)
2009-10-21 23:00:00 (+01:00 - trunking DST only by getDate() as a pure date 
without time can not have DST, but adding timezone as it is locale 
dependend, this value is set)


Your problem is that you are mixing date only calculation with date/time 
calculation. By stripping parts in the middle of your calculation you get 
unexpected behaviour.


Why don't you set the time to 0 (setTime() instead of getDate()) or simply 
use the instance as is and output the date only 
(toString(Zend_Date::DATES))?


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Саша Стаменковић umpir...@gmail.com

To: Thomas Weidner thomas.weid...@gmx.at
Cc: fw-general@lists.zend.com
Sent: Wednesday, November 11, 2009 9:44 AM
Subject: Re: [fw-general] Zend_Date problem


Looks like you didn't use my piece of code to reproduce the problem:

$date = new Zend_Date(null, null, $locale);
$date-setTimestamp(1256198496);
echo $date-getDate()-toString(Zend_Date::DATES);

Using this:

$date = new Zend_Date(null, null, $locale);
$date-setTimestamp(1256198496);
echo $date-getDate()-toString();

I get

21 Oct 2009 23:00:00

which is again wrong.

If I understand well, Zend_Date is determining which timezone to use by
locale passed in constructor. But by looking in constructor docblock I
figured that it's read from PHP

/**
* Generates the standard date object, could be a unix timestamp,
localized date,
* string, integer, array and so on. Also parts of dates or time are
supported
* Always set the default timezone:
http://php.net/date_default_timezone_set
* For example, in your bootstrap:
date_default_timezone_set('America/Los_Angeles');
* For detailed instructions please look in the docu.
*
* @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
or value of date part to set
* ,depending on $part.
If null the actual time is set
* @param  string  $partOPTIONAL Defines the
input format of $date
* @param  string|Zend_Locale  $locale  OPTIONAL Locale for
parsing input
* @return Zend_Date
* @throws Zend_Date_Exception
*/
   public function __construct($date = null, $part = null, $locale = null)

and in line #184 it's obvious

// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this-setTimezone($zone);

I use zf 1.9.5.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner 
thomas.weid...@gmx.atwrote:



Creating the instance affects the timezone.
Using set methods affect the timezone.
The manual states multiple ways (more than 20?) to affect the timezone.

In the code you gave the locale affects the timezone.
And we still don't know how your complete date looks like.
So all we can do is prediction.

And using your code on both locales I get:
sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
en_GB:string '2009-10-22T10:01:36+02:00' (length=25)


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Саша Стаменковић umpir...@gmail.com
To: Thomas Weidner thomas.weid...@gmx.at

Cc: fw-general@lists.zend.com
Sent: Wednesday, November 11, 2009 8:47 AM

Subject: Re: [fw-general] Zend_Date problem


How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner thomas.weid...@gmx.at
wrote:

 Sorry, but date_default_timezone_set has no effect on the timezone which

is
actually used by the instance of Zend_Date nor has it effect on DST.
My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving
partitial informations ?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Саша Стаменковић umpir...@gmail.com

To: kobsu ko...@iki.fi
Cc: fw-general@lists.zend.com
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem



@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards

Re: [fw-general] Zend_Date problem

2009-11-11 Thread Саша Стаменковић
I see, right way would be :

$date = new Zend_Date(null, null, $locale);
$date-setTimestamp(1256198496);
echo $date-toString(Zend_Date::DATES);

Big thanks Thomas!

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 12:06 PM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Looks like you didn't use my piece of code to reproduce the problem:


 Look like you did not output all date parts.
 Why should I use your code when it's obviously wrong ?

 You set the actual date with time, timezone and DST.
 F.e. 2009-11-11 05:00:00+02:00

 Then you set a timestamp overwriting the previous date and time but leaving
 timezone and DST.
 This leads to 2009-10-22 10:01:36+02:00.

 Then you cut of the time from the instance but still using DST.

 Reason:
 You used getDate - this strips the time and returns ONLY date
 2009-10-22 10:01:36+02:00 - before
 2009-10-22 00:00:00 (+02:00-trunking time internally by getDate())
 2009-10-21 22:00:00 (+00:00- trunking timezone and DST)
 2009-10-21 23:00:00 (+01:00 - trunking DST only by getDate() as a pure
 date without time can not have DST, but adding timezone as it is locale
 dependend, this value is set)

 Your problem is that you are mixing date only calculation with date/time
 calculation. By stripping parts in the middle of your calculation you get
 unexpected behaviour.

 Why don't you set the time to 0 (setTime() instead of getDate()) or simply
 use the instance as is and output the date only
 (toString(Zend_Date::DATES))?


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Саша Стаменковић umpir...@gmail.com
 To: Thomas Weidner thomas.weid...@gmx.at
 Cc: fw-general@lists.zend.com
 Sent: Wednesday, November 11, 2009 9:44 AM

 Subject: Re: [fw-general] Zend_Date problem


 Looks like you didn't use my piece of code to reproduce the problem:

 $date = new Zend_Date(null, null, $locale);
 $date-setTimestamp(1256198496);
 echo $date-getDate()-toString(Zend_Date::DATES);

 Using this:

 $date = new Zend_Date(null, null, $locale);
 $date-setTimestamp(1256198496);
 echo $date-getDate()-toString();

 I get

 21 Oct 2009 23:00:00

 which is again wrong.

 If I understand well, Zend_Date is determining which timezone to use by
 locale passed in constructor. But by looking in constructor docblock I
 figured that it's read from PHP

 /**
* Generates the standard date object, could be a unix timestamp,
 localized date,
* string, integer, array and so on. Also parts of dates or time are
 supported
* Always set the default timezone:
 http://php.net/date_default_timezone_set
* For example, in your bootstrap:
 date_default_timezone_set('America/Los_Angeles');
* For detailed instructions please look in the docu.
*
* @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
 or value of date part to set
* ,depending on $part.
 If null the actual time is set
* @param  string  $partOPTIONAL Defines the
 input format of $date
* @param  string|Zend_Locale  $locale  OPTIONAL Locale for
 parsing input
* @return Zend_Date
* @throws Zend_Date_Exception
*/
   public function __construct($date = null, $part = null, $locale = null)

 and in line #184 it's obvious

 // set the timezone and offset for $this
 $zone = @date_default_timezone_get();
 $this-setTimezone($zone);

 I use zf 1.9.5.

 Regards,
 Saša Stamenković


 On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Creating the instance affects the timezone.
 Using set methods affect the timezone.
 The manual states multiple ways (more than 20?) to affect the timezone.

 In the code you gave the locale affects the timezone.
 And we still don't know how your complete date looks like.
 So all we can do is prediction.

 And using your code on both locales I get:
 sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
 en_GB:string '2009-10-22T10:01:36+02:00' (length=25)


 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Саша Стаменковић umpir...@gmail.com
 
 To: Thomas Weidner thomas.weid...@gmx.at

 Cc: fw-general@lists.zend.com
 Sent: Wednesday, November 11, 2009 8:47 AM

 Subject: Re: [fw-general] Zend_Date problem


 How do I set timezone to affect Zend_Date component?
 I use zend date to create view helper for date formatting.

 Regards,
 Saša Stamenković


 On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner thomas.weid...@gmx.at
 wrote:

  Sorry, but date_default_timezone_set has no effect on the timezone which

 is
 actually used by the instance of Zend_Date nor has it effect on DST.
 My question was related to the instance not your environment.

 Why don't you output all dateparts from the instance instead of giving
 partitial informations ?

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http

Re: [fw-general] Zend_Date problem

2009-11-10 Thread Thomas Weidner

Timezone ?

Mfg
Thomas

- Original Message - 
From: umpirsky umpir...@gmail.com

To: fw-general@lists.zend.com
Sent: Tuesday, November 10, 2009 2:23 PM
Subject: [fw-general] Zend_Date problem




Hi zf community.

This code:

$date = new Zend_Date(null, null, $locale);
$date-setTimestamp(1256198496);
echo $date-getDate()-toString(Zend_Date::DATES);

gives date 21.10.2009. for sr_RS locale (similar for other locales), for
en_GB it gives 21 Oct 2009.
I expect 22 Oct 2009. it's whole day missed?!?!?

Any idea?
--
View this message in context: 
http://old.nabble.com/Zend_Date-problem-tp26283342p26283342.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date problem

2009-11-10 Thread kobsu

Try
Zend_Date::setOptions(array('fix_dst' = true));

before
$date = new Zend_Date();


umpirsky wrote:
 
 Hi zf community.
 
 This code:
 
 $date = new Zend_Date(null, null, $locale);
 $date-setTimestamp(1256198496);
 echo $date-getDate()-toString(Zend_Date::DATES);
 
 gives date 21.10.2009. for sr_RS locale (similar for other locales), for
 en_GB it gives 21 Oct 2009.
 I expect 22 Oct 2009. it's whole day missed?!?!?
 
 Any idea?
 

-- 
View this message in context: 
http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date problem

2009-11-10 Thread Саша Стаменковић
@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu ko...@iki.fi wrote:


 Try
 Zend_Date::setOptions(array('fix_dst' = true));

 before
 $date = new Zend_Date();


 umpirsky wrote:
 
  Hi zf community.
 
  This code:
 
  $date = new Zend_Date(null, null, $locale);
  $date-setTimestamp(1256198496);
  echo $date-getDate()-toString(Zend_Date::DATES);
 
  gives date 21.10.2009. for sr_RS locale (similar for other locales), for
  en_GB it gives 21 Oct 2009.
  I expect 22 Oct 2009. it's whole day missed?!?!?
 
  Any idea?
 

 --
 View this message in context:
 http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend_Date problem

2009-11-10 Thread Thomas Weidner
Sorry, but date_default_timezone_set has no effect on the timezone which is 
actually used by the instance of Zend_Date nor has it effect on DST.

My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving 
partitial informations ?


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Саша Стаменковић umpir...@gmail.com

To: kobsu ko...@iki.fi
Cc: fw-general@lists.zend.com
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem


@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu ko...@iki.fi wrote:



Try
Zend_Date::setOptions(array('fix_dst' = true));

before
$date = new Zend_Date();


umpirsky wrote:

 Hi zf community.

 This code:

 $date = new Zend_Date(null, null, $locale);
 $date-setTimestamp(1256198496);
 echo $date-getDate()-toString(Zend_Date::DATES);

 gives date 21.10.2009. for sr_RS locale (similar for other locales), for
 en_GB it gives 21 Oct 2009.
 I expect 22 Oct 2009. it's whole day missed?!?!?

 Any idea?


--
View this message in context:
http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
Sent from the Zend Framework mailing list archive at Nabble.com.






Re: [fw-general] Zend_Date problem

2009-11-10 Thread Саша Стаменковић
How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner thomas.weid...@gmx.atwrote:

 Sorry, but date_default_timezone_set has no effect on the timezone which is
 actually used by the instance of Zend_Date nor has it effect on DST.
 My question was related to the instance not your environment.

 Why don't you output all dateparts from the instance instead of giving
 partitial informations ?

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Саша Стаменковић umpir...@gmail.com
 To: kobsu ko...@iki.fi
 Cc: fw-general@lists.zend.com
 Sent: Wednesday, November 11, 2009 7:59 AM
 Subject: Re: [fw-general] Zend_Date problem



 @Thomas Weidner
 *
 *
 date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

 @kobsu
 *
 *
 *Same result :(
 *
 Regards,
 Saša Stamenković


 On Tue, Nov 10, 2009 at 6:20 PM, kobsu ko...@iki.fi wrote:


 Try
 Zend_Date::setOptions(array('fix_dst' = true));

 before
 $date = new Zend_Date();


 umpirsky wrote:
 
  Hi zf community.
 
  This code:
 
  $date = new Zend_Date(null, null, $locale);
  $date-setTimestamp(1256198496);
  echo $date-getDate()-toString(Zend_Date::DATES);
 
  gives date 21.10.2009. for sr_RS locale (similar for other locales), for
  en_GB it gives 21 Oct 2009.
  I expect 22 Oct 2009. it's whole day missed?!?!?
 
  Any idea?
 

 --
 View this message in context:
 http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
 Sent from the Zend Framework mailing list archive at Nabble.com.






Re: [fw-general] Zend_Date error in conversion from timestamp

2009-10-27 Thread drm

umpirsky wrote:

expected result is 2010-03-01. The whole year is missed :)
  

Quoting PHP manual:

---
o - ISO-8601 year number. This has the same value as /Y/, except that if 
the ISO week number (/W/) belongs to the previous or next year, that 
year is used instead. (added in PHP 5.1.0)

---

Output of date('W', 1262476800) is 53, so that timestamp falls into the 
last week of 2009, so the output is expected.


As for Zend_Date, again, quoting manual:
Y: Year according to ISO 8601, at least one digit 

Apparently, the ISO8601 standard uses the week number as a benchmark for 
the year. Since the output matches the documentation, I'd say it is 
expected behaviour :-)


You'd probably want to use 'y' (lowercased) in stead of uppercased to 
get the output you wish for.
Also, be aware that 'm' is not the same as 'M' (meaning minutes and 
months respectively)


HTH

drm / Gerard


Re: [fw-general] Zend_Date error in conversion from timestamp

2009-10-27 Thread Саша Стаменковић
Great, thanks.

Regards,
Saša Stamenković


On Tue, Oct 27, 2009 at 12:35 PM, drm d...@melp.nl wrote:

 umpirsky wrote:

 expected result is 2010-03-01. The whole year is missed :)


 Quoting PHP manual:

 ---
 o - ISO-8601 year number. This has the same value as /Y/, except that if
 the ISO week number (/W/) belongs to the previous or next year, that year is
 used instead. (added in PHP 5.1.0)
 ---

 Output of date('W', 1262476800) is 53, so that timestamp falls into the
 last week of 2009, so the output is expected.

 As for Zend_Date, again, quoting manual:
 Y: Year according to ISO 8601, at least one digit 

 Apparently, the ISO8601 standard uses the week number as a benchmark for
 the year. Since the output matches the documentation, I'd say it is expected
 behaviour :-)

 You'd probably want to use 'y' (lowercased) in stead of uppercased to get
 the output you wish for.
 Also, be aware that 'm' is not the same as 'M' (meaning minutes and months
 respectively)

 HTH

 drm / Gerard



Re: [fw-general] Zend_Date Problems

2009-04-08 Thread Chris MacPherson

You can use the -toString() method to output custom date formats like this:

$date = new Zend_Date(); // Passing no params sets to current date.
$date-toString('-MM-dd HH:mm:ss');

See http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.selfdefinedformats for date part specifiers. 





hardik82 wrote:

Hello, can anyone tell me how i can get current date in format[-MM-dd
HH:mm:ss]

milesap wrote:
  

Hello,

I'm fairly new to Zend Framework, so forgive me if this is a really easy
question. I have been looking everywhere for a solution. I am trying to
get the difference between the current date and a persons birthday to see
how old they are.

$date = new Zend_Date();
$date-sub('April 3, 1980');

print $date-toString('Y');

The following prints 28, however the correct age would be 29, as the
persons birthday was a few days ago. Does it not take the month and day
into account when it subs the date? Or a better question would be what am
I doing wrong?

I have set my default timezone correctly.




  


Re: [fw-general] Zend_Date Problems

2009-04-08 Thread Thomas VEQUAUD
+1 : I have the same problem with the age calculation


On Tue, Apr 7, 2009 at 7:24 PM, Daryl Handley darylhand...@gmail.comwrote:

 milesap wrote:

 Hello,

 I'm fairly new to Zend Framework, so forgive me if this is a really easy
 question. I have been looking everywhere for a solution. I am trying to
 get
 the difference between the current date and a persons birthday to see how
 old they are.

$date = new Zend_Date();
$date-sub('April 3, 1980');

print $date-toString('Y');

 The following prints 28, however the correct age would be 29, as the
 persons
 birthday was a few days ago. Does it not take the month and day into
 account
 when it subs the date? Or a better question would be what am I doing
 wrong?

 I have set my default timezone correctly.


 I'm no Zend_Date expert, but I've been looking at this for a bit mostly
 because I am interested in how Zend_Date works. The behaviour of -sub seems
 a bit erratic. I would expect the following 2 code fragments to output the
 same thing.

   $date = new Zend_Date('April 7, 2009');
   $date-sub('April 3, 1980');
   print $date-toString() . \n;
 $date = new Zend_Date('April 7, 2009');
   $date-sub(new Zend_Date('April 3, 1980'));
   print $date-toString() . \n;

 but they don't. The output is

 Dec 6, 0028 3:00:00 PM
 Jan 4, 1999 3:00:00 PM

 I also experiment with 'y' vs 'Y' as suggested by Thomas and still got 28.
 Gotta go do some other stuff, may take a look again later.

 Daryl






-- 
Thomas VEQUAUD  http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07


Re: [fw-general] Zend_Date Problems

2009-04-07 Thread Thomas Weidner

Note the difference between Y and y.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: milesap mile...@gmail.com

To: fw-general@lists.zend.com
Sent: Tuesday, April 07, 2009 4:51 AM
Subject: [fw-general] Zend_Date Problems




Hello,

I'm fairly new to Zend Framework, so forgive me if this is a really easy
question. I have been looking everywhere for a solution. I am trying to 
get

the difference between the current date and a persons birthday to see how
old they are.

   $date = new Zend_Date();
   $date-sub('April 3, 1980');

   print $date-toString('Y');

The following prints 28, however the correct age would be 29, as the 
persons
birthday was a few days ago. Does it not take the month and day into 
account
when it subs the date? Or a better question would be what am I doing 
wrong?


I have set my default timezone correctly.
--
View this message in context: 
http://www.nabble.com/Zend_Date-Problems-tp22921295p22921295.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date Problems

2009-04-07 Thread Daryl Handley

milesap wrote:

Hello,

I'm fairly new to Zend Framework, so forgive me if this is a really easy
question. I have been looking everywhere for a solution. I am trying to get
the difference between the current date and a persons birthday to see how
old they are.

$date = new Zend_Date();
$date-sub('April 3, 1980');

print $date-toString('Y');

The following prints 28, however the correct age would be 29, as the persons
birthday was a few days ago. Does it not take the month and day into account
when it subs the date? Or a better question would be what am I doing wrong?

I have set my default timezone correctly.
  
I'm no Zend_Date expert, but I've been looking at this for a bit mostly 
because I am interested in how Zend_Date works. The behaviour of -sub 
seems a bit erratic. I would expect the following 2 code fragments to 
output the same thing.


 
   $date = new Zend_Date('April 7, 2009');

   $date-sub('April 3, 1980');
   print $date-toString() . \n;
  
   $date = new Zend_Date('April 7, 2009');

   $date-sub(new Zend_Date('April 3, 1980'));
   print $date-toString() . \n;

but they don't. The output is

Dec 6, 0028 3:00:00 PM
Jan 4, 1999 3:00:00 PM

I also experiment with 'y' vs 'Y' as suggested by Thomas and still got 
28. Gotta go do some other stuff, may take a look again later.


Daryl





Re: [fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

$date = new Zend_Date('2009-03-09 09:20', Zend_Date::ISO_8601);
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


Joó Ádám schrieb:
 Hi list,
 
 I get the exception “Unable to parse the date format string 'ISO_8601'
 at letter 'O'” when executing the following:
 
 $date = new Zend_Date('2009-03-09 09:20', 'ISO_8601');
 
 This was working properly a few days ago, what could be the problem?
 
 
 Thanks,
 Ádám
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm016sACgkQ0HfT5Ws789CU/QCfZrMt0e7rdV51UX30b17ApRHJ
5VkAoMttpFf4Ux1+HFc9OVDbmFJmWWU2
=EDJg
-END PGP SIGNATURE-


Re: [fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Joó Ádám
 $date = new Zend_Date('2009-03-09 09:20', Zend_Date::ISO_8601);

Ah, so it’s value had changed to 'c'…
Thanks, DASPRiD!

Ádám


Re: [fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Well, just don't use internal values but the public constants.
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


Joó Ádám schrieb:
 $date = new Zend_Date('2009-03-09 09:20', Zend_Date::ISO_8601);
 
 Ah, so it’s value had changed to 'c'…
 Thanks, DASPRiD!
 
 Ádám
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm07TUACgkQ0HfT5Ws789DnogCgyVyKkd0Xtq9KeOe5i54cDUrI
29sAoIyLHGJ9gUfD798FZhirIpvorMLD
=W2M9
-END PGP SIGNATURE-


Re: [fw-general] Zend_Date and PHP datetime formats not working with toString()

2009-01-09 Thread jsor

Hello,


webPragmatist wrote:
 
 I'm having an issue... I can't format using the PHP date() function
 convention when calling $date-toString()
 br /br /
 Here's what I have:
 pre
 $tokenExpiry = new Zend_Date();
$tokenExpiry-add(3, Zend_Date::DAY);
 $tokenExpiry-setTimezone($config-application-timezone-out);
 $tokenExpiry-toString('D. d F, Y g:ha O');
 /pre
 It should just make a day that is three days from now and configure it's
 timestamp. Regular toString() works but when I use the date() param it
 returns:br /br /
 10. 11 F, 2009 g:4PM O
 

if you want to use date() format specifier, you must set
Zend_Date::setOptions(array('format' = 'php')) before.

See:
http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.phpformats

Cheers, Jan
-- 
View this message in context: 
http://www.nabble.com/Zend_Date-and-PHP-datetime-formats-not-working-with-toString%28%29-tp21362428p21368637.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] zend_date settime question

2009-01-06 Thread Thomas Weidner
And you also receive the error when you strip of the complete setTime() 
call.
The exception you mentioned is thrown in a single place... when you call 
setDate().

And on one single reason... when the given string is 'null'.

Maybe you call this method twice in your code ?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Tim Rupp caphrim...@gmail.com

To: fw-general@lists.zend.com
Sent: Tuesday, January 06, 2009 8:27 PM
Subject: [fw-general] zend_date settime question



Hi list,

I may be going about this the wrong way, so if that's the extent of
the problem, then I'd appreciate some pointers. Btw, I'm using ZF
1.7.2.

I create a zend_date object, use setdate and then try to use settime,
but get an exception message of parameter $date must be set, null is
not allowed. I looked into it and it appears to stem from my lack of
specifying a number of seconds to settime.

My data is the following

$expireTime = 01:30 AM;
$expireDate = 01/06/2009;

I'm then doing this

$date = new Zend_Date;
$date-setDate($expireDate);
$date-setTime($expireTime, 'hh:mm');

And it's choking on the setTime call. Am I just misunderstanding the
use of setTime here? Or is this a bug in Zend_Date or ??? I also
receive the error if I strip off the  AM part. So specifying seconds
are required? I can't make it default to just zero?

Any help is appreciated.
Thanks,
Tim 




Re: [fw-general] zend_date settime question

2009-01-06 Thread PHPScriptor

try to add seconds then it works:

$expireTime = 01:30:00 AM;
$date-setTime($expireTime, 'hh:mm:ss');


Tim Rupp wrote:
 
 Hi list,
 
 I may be going about this the wrong way, so if that's the extent of
 the problem, then I'd appreciate some pointers. Btw, I'm using ZF
 1.7.2.
 
 I create a zend_date object, use setdate and then try to use settime,
 but get an exception message of parameter $date must be set, null is
 not allowed. I looked into it and it appears to stem from my lack of
 specifying a number of seconds to settime.
 
 My data is the following
 
  $expireTime = 01:30 AM;
  $expireDate = 01/06/2009;
 
 I'm then doing this
 
  $date = new Zend_Date;
  $date-setDate($expireDate);
  $date-setTime($expireTime, 'hh:mm');
 
 And it's choking on the setTime call. Am I just misunderstanding the
 use of setTime here? Or is this a bug in Zend_Date or ??? I also
 receive the error if I strip off the  AM part. So specifying seconds
 are required? I can't make it default to just zero?
 
 Any help is appreciated.
 Thanks,
 Tim
 
 


-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/zend_date-settime-question-tp21317298p21317765.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] zend_date settime question

2009-01-06 Thread Tim Rupp
Well, using this script, no exception is thrown

?php

require 'Zend/Date.php';

$expireTime = 01:30 AM;
$expireDate = 01/06/2009;

$date = new Zend_Date;
$date-setDate($expireDate);

?


So maybe I'm not following you here, but it appears that stripping off
the complete setTime call results in no error.

But setTime() calls _time()

_time() gets to line 2706 where it creates a new instance of Zend_Date
and calls set($parsed['second']) which in my test is empty.

Function set() calls _calculate() with that empty value, and then
_calculate throws the parameter $date must be set, null is not
allowed message.

And therein lies the problem I think.

Ideas? Thanks,
Tim

On Tue, Jan 6, 2009 at 1:42 PM, Thomas Weidner thomas.weid...@gmx.at wrote:
 And you also receive the error when you strip of the complete setTime()
 call.
 The exception you mentioned is thrown in a single place... when you call
 setDate().
 And on one single reason... when the given string is 'null'.

 Maybe you call this method twice in your code ?

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Tim Rupp caphrim...@gmail.com
 To: fw-general@lists.zend.com
 Sent: Tuesday, January 06, 2009 8:27 PM
 Subject: [fw-general] zend_date settime question


 Hi list,

 I may be going about this the wrong way, so if that's the extent of
 the problem, then I'd appreciate some pointers. Btw, I'm using ZF
 1.7.2.

 I create a zend_date object, use setdate and then try to use settime,
 but get an exception message of parameter $date must be set, null is
 not allowed. I looked into it and it appears to stem from my lack of
 specifying a number of seconds to settime.

 My data is the following

$expireTime = 01:30 AM;
$expireDate = 01/06/2009;

 I'm then doing this

$date = new Zend_Date;
$date-setDate($expireDate);
$date-setTime($expireTime, 'hh:mm');

 And it's choking on the setTime call. Am I just misunderstanding the
 use of setTime here? Or is this a bug in Zend_Date or ??? I also
 receive the error if I strip off the  AM part. So specifying seconds
 are required? I can't make it default to just zero?

 Any help is appreciated.
 Thanks,
 Tim




Re: [fw-general] zend_date settime question

2009-01-06 Thread Tim Rupp
Yeah, I figured I could do that if I exhausted all my other options, I
was hoping there would be a cleaner solution though. I'd like to not
massage the time like that if I can avoid it.

Thanks for the tip though.

Tim

On Tue, Jan 6, 2009 at 1:55 PM, PHPScriptor cont...@phpscriptor.com wrote:

 try to add seconds then it works:

 $expireTime = 01:30:00 AM;
 $date-setTime($expireTime, 'hh:mm:ss');


 Tim Rupp wrote:

 Hi list,

 I may be going about this the wrong way, so if that's the extent of
 the problem, then I'd appreciate some pointers. Btw, I'm using ZF
 1.7.2.

 I create a zend_date object, use setdate and then try to use settime,
 but get an exception message of parameter $date must be set, null is
 not allowed. I looked into it and it appears to stem from my lack of
 specifying a number of seconds to settime.

 My data is the following

  $expireTime = 01:30 AM;
  $expireDate = 01/06/2009;

 I'm then doing this

  $date = new Zend_Date;
  $date-setDate($expireDate);
  $date-setTime($expireTime, 'hh:mm');

 And it's choking on the setTime call. Am I just misunderstanding the
 use of setTime here? Or is this a bug in Zend_Date or ??? I also
 receive the error if I strip off the  AM part. So specifying seconds
 are required? I can't make it default to just zero?

 Any help is appreciated.
 Thanks,
 Tim




 -
 visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/
 --
 View this message in context: 
 http://www.nabble.com/zend_date-settime-question-tp21317298p21317765.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] zend_date settime question

2009-01-06 Thread PHPScriptor

I checked the zend code. The problem sits here:

Data.php

(line 2776 function private function _time)

$parsed = Zend_Locale_Format::getTime($time, array('date_format' = $format,
'locale' = $locale, 'format_type' = 'iso'));

you get back an array with $parsed['hour']=01 and $parsed['minute']=30 (and
some others). But not with $parsed['second']. That seems fair to me. But in
the following lines you get:

$time-set($parsed['hour'],   self::HOUR);
$time-set($parsed['minute'], self::MINUTE);
$time-set($parsed['second'], self::SECOND); = and that's where he crashes

so better would be something like this:

if($parsed['hour'])
  $time-set($parsed['hour'],   self::HOUR);
if($parsed[minute])
  $time-set($parsed[minute],   self::MINUTE);

or something like this. If not, using 'hh:mm' has no use (IMHO)

-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/zend_date-settime-question-tp21317298p21320361.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date and Timezones - how do I turn them off?

2008-12-14 Thread Thomas Weidner
To prevent timezone calculation you should use UTC as timezone. This 
timezone has no DST.
But be aware of possible time differences when your input is not UTC but 
GMT.


Also to note: UTC is also a timezone and will be displayed in the output. It 
just uses no DST, that's all.
ISO_8601 is the complete ISO representation. It's recognised by all common 
DBs and is always with timezone.
To prevent output you could use the toString method and create your own 
format.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Cameron themsel...@gmail.com

To: Zend Framework - General fw-general@lists.zend.com
Sent: Monday, December 15, 2008 5:59 AM
Subject: [fw-general] Zend_Date and Timezones - how do I turn them off?



Hi guys,

I'm just doing a bit of work with the Dojo date and time pickers, and it's
all going wonderfully, and I decided to use the Zend_Date::ISO_8601 method
for formatting the output from MySQL, which works perfectly well, all 
except
for the fact it's appending a timezone, which then goes and screws with 
the

time that gets displayed in the time picker - i wouldn't have noticed this
if it wasn't for DST!

Anyway, all I want is to basically turn off the whole timezone thing - I
don't need it for this project, and it's much more obvious for the time
stored in the DB to be the time of the event, not a GMT representation of
it. I tried $date-setTimezone(NULL); and $date-setTimezone(''); but I 
got
nothing. Of course I can chop the last 6 chars off the string and 
everything
will be fine, but i'd rather not have to resort to such clunkiness if at 
all

possible.





Re: [fw-general] zend_date with milliseconds question

2008-11-24 Thread Thomas Weidner

Milliseconds are not supported in a default date/time string.
But you can set them with setMillisecond.

S is the millisecond part of a date (as set with setMillisecond)
But A are the elapsed seconds of the actual day within the set timestamp.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Tim Rupp [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Monday, November 24, 2008 8:48 PM
Subject: [fw-general] zend_date with milliseconds question



Hi list, I noticed in the documentation for Zend_Date (
http://framework.zend.com/manual/en/zend.date.constants.html ) that 3
constants are available for outputting a millisecond time; S, A, and
Zend_Date::MILLISECOND.

When I use the constants though, I get different values. S returns 0
and A returns 49410 or some other slowly increasing number (looking at
the code it looks like the current number of seconds that have elapsed
in the day)

If I do this

 $date-get(Zend_Date::MILLISECOND);

I get 0, the same as using S.

My question, is which of the constants specified in the documentation
is correct?

Creating a new date object does not set the milliseconds value either.
I'm using version 1.6.1.

Thanks,
Tim


Re: [fw-general] zend_date with milliseconds question

2008-11-24 Thread Tim Rupp
Thanks Thomas for that clarification. That would lead me to believe
the documentation for A is incorrect then?

-Tim

On Mon, Nov 24, 2008 at 1:59 PM, Thomas Weidner [EMAIL PROTECTED] wrote:
 Milliseconds are not supported in a default date/time string.
 But you can set them with setMillisecond.

 S is the millisecond part of a date (as set with setMillisecond)
 But A are the elapsed seconds of the actual day within the set timestamp.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - From: Tim Rupp [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Monday, November 24, 2008 8:48 PM
 Subject: [fw-general] zend_date with milliseconds question


 Hi list, I noticed in the documentation for Zend_Date (
 http://framework.zend.com/manual/en/zend.date.constants.html ) that 3
 constants are available for outputting a millisecond time; S, A, and
 Zend_Date::MILLISECOND.

 When I use the constants though, I get different values. S returns 0
 and A returns 49410 or some other slowly increasing number (looking at
 the code it looks like the current number of seconds that have elapsed
 in the day)

 If I do this

  $date-get(Zend_Date::MILLISECOND);

 I get 0, the same as using S.

 My question, is which of the constants specified in the documentation
 is correct?

 Creating a new date object does not set the milliseconds value either.
 I'm using version 1.6.1.

 Thanks,
 Tim



Re: [fw-general] zend_date with milliseconds question

2008-11-24 Thread Thomas Weidner

Yes... Elapsed seconds of this day is the correct description.
Please add a issue ot jira so we can fix it. Thnx

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Tim Rupp [EMAIL PROTECTED]

To: Thomas Weidner [EMAIL PROTECTED]
Cc: fw-general@lists.zend.com
Sent: Monday, November 24, 2008 9:13 PM
Subject: Re: [fw-general] zend_date with milliseconds question



Thanks Thomas for that clarification. That would lead me to believe
the documentation for A is incorrect then?

-Tim

On Mon, Nov 24, 2008 at 1:59 PM, Thomas Weidner [EMAIL PROTECTED] 
wrote:

Milliseconds are not supported in a default date/time string.
But you can set them with setMillisecond.

S is the millisecond part of a date (as set with setMillisecond)
But A are the elapsed seconds of the actual day within the set timestamp.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Tim Rupp [EMAIL PROTECTED]
To: fw-general@lists.zend.com
Sent: Monday, November 24, 2008 8:48 PM
Subject: [fw-general] zend_date with milliseconds question



Hi list, I noticed in the documentation for Zend_Date (
http://framework.zend.com/manual/en/zend.date.constants.html ) that 3
constants are available for outputting a millisecond time; S, A, and
Zend_Date::MILLISECOND.

When I use the constants though, I get different values. S returns 0
and A returns 49410 or some other slowly increasing number (looking at
the code it looks like the current number of seconds that have elapsed
in the day)

If I do this

 $date-get(Zend_Date::MILLISECOND);

I get 0, the same as using S.

My question, is which of the constants specified in the documentation
is correct?

Creating a new date object does not set the milliseconds value either.
I'm using version 1.6.1.

Thanks,
Tim






Re: [fw-general] Zend_Date Issue Cloning Dates

2008-10-29 Thread Thomas Weidner

Not really a problem of Zend_Date in my opinion.
When you clone a object you will have 2 different objects as per OOP 
definition.


This is nothing which can be manipulated by Zend_Date.
All methods you called are not static, so they only belong to the called 
instance.


You could try to use the copy method instead of cloning the object 
yourself... but this should not change anything.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Juan Felipe Alvarez Saldarriaga [EMAIL PROTECTED]

To: fw-general fw-general@lists.zend.com
Sent: Wednesday, October 29, 2008 5:25 PM
Subject: [fw-general] Zend_Date Issue Cloning Dates



Hey!

I have an issue when I try to store Zend_Date object into an array, I 
guess is not Zend_Date but I don't know what it happend, that's hwat I 
got:


I get some dates from the database, I create a Zend_Date object with this 
db date then I clone it and add some stuff to the object, then I store 
every object in an array, but when I try to print the $date-toString() 
date I have duplicated dates, I mean $objStart == $objEnd, like isn't 
cloned.


...

$arrTimes = array();

while ( $arrRowData = $objDbStatement-fetch() )
{
   $objStart = new Zend_Date( $arrRowData['work_time_specific_date'], 
Zend_Date::ISO_8601, Zend_Registry::get( objLocale ) );


   $objStart-setTimeZone( 'UCT' );

   $objEnd = clone $objStart;

   $objStart-setTime( $arrRowData['time_start'] );

   $objEnd-setTime( $arrRowData['time_end'] );

   $arrTimes[] = array(
   'start' = $objStart,
   'end' = $objEnd,
   'type' = 'enabled'
   );
}

...

Thx for any help. 




Re: [fw-general] Zend_Date arithmetic: difference in days (not seconds) between two dates

2008-10-21 Thread Thomas Weidner

You tried to calculate days manually but you did not thought of DST.
Simply use the difference as input for a new date

$days = $date2-subDate($date1)-get(Zend_Date::DAY_OF_YEAR) - 1;

Simple maths :-)
PS: Does not work for dates which differ more than a year.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: David Mintz [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Monday, October 20, 2008 11:27 PM
Subject: [fw-general] Zend_Date arithmetic: difference in days (not seconds) 
between two dates



I would like to compute the difference in days between two dates. I have 
the

fix_dst option set to true and the timezone is America/New York. A DST
change happened in my timezone on March 9, 2008. So,

$date1 = new Zend_Date(array(
'year'= 2008,
   'month'=3,
   'day'=7,
   'hour'=12,
));

$date2 = new Zend_Date(array(
   'year'= 2008,
'month'=3,
   'day'=10,
   'hour'=12,
));

$diff = $date2-sub($date1);
print  difference in days is .$diff/86400;

And the output is not what I want to hear, i.e., not 3 but 2.95833

I think I understand, Zend_Date is telling me how many seconds actually
elapsed between the two dates. But I want to figure out the days, 
accounting
for the fact that one of the intervening days had only 23 hours. What's 
the

correct approach?

Thanks.

--
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness





Re: [fw-general] Zend_Date to validate input date format

2008-10-15 Thread Thomas Weidner

The first one is because Zend_Date ignores all other parts except numbers.
The date parsing is actually not as strict as for strings.
To have a strict date parsing you would simply have to validate it as 
string, for example with a fixed length.
A true from isDate does only mean that Zend_Date can handle this date with 
the given format, it does not mean that the input format is strictly 
identical.
Zend_Date can fix much notations automatically. This is the reason why it 
returns true even if you may not have expected this.


But why should the second one be a wrong format ?
The year 1005 exists, the Month 09 exists and the day 01 exists.
It is very far in the past ut still this is a valid date.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Kexiao Liao [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Wednesday, October 15, 2008 4:20 PM
Subject: [fw-general] Zend_Date to validate input date format




I use Zend_Date class to validate the input date format as showing below

Zend_Date::isDate ( $value, '-M-d' )

However the following input date values CAN NOT BE detected as wrong 
format

2003--10-1
1005-09-01

Is this a bug for Zend_Date class? Please give your comments. Thanks.

Kevin


--
View this message in context: 
http://www.nabble.com/Zend_Date-to-validate-input-date-format-tp19994516p19994516.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date to validate input date format

2008-10-15 Thread Kexiao Liao

Is there any easy way we can use Zend Framework to find 2003--10-1 is an
invalid input date format?
 

thomasW wrote:
 
 The first one is because Zend_Date ignores all other parts except numbers.
 The date parsing is actually not as strict as for strings.
 To have a strict date parsing you would simply have to validate it as 
 string, for example with a fixed length.
 A true from isDate does only mean that Zend_Date can handle this date with 
 the given format, it does not mean that the input format is strictly 
 identical.
 Zend_Date can fix much notations automatically. This is the reason why it 
 returns true even if you may not have expected this.
 
 But why should the second one be a wrong format ?
 The year 1005 exists, the Month 09 exists and the day 01 exists.
 It is very far in the past ut still this is a valid date.
 
 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com
 
 - Original Message - 
 From: Kexiao Liao [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Wednesday, October 15, 2008 4:20 PM
 Subject: [fw-general] Zend_Date to validate input date format
 
 

 I use Zend_Date class to validate the input date format as showing below

 Zend_Date::isDate ( $value, '-M-d' )

 However the following input date values CAN NOT BE detected as wrong 
 format
 2003--10-1
 1005-09-01

 Is this a bug for Zend_Date class? Please give your comments. Thanks.

 Kevin


 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Date-to-validate-input-date-format-tp19994516p19994516.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-to-validate-input-date-format-tp19994516p19995235.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date to validate input date format

2008-10-15 Thread Thomas Weidner

As I said, you have to validate against fixed string length.
Simply use a filter chain to archive this.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Kexiao Liao [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Wednesday, October 15, 2008 4:53 PM
Subject: Re: [fw-general] Zend_Date to validate input date format




Is there any easy way we can use Zend Framework to find 2003--10-1 is an
invalid input date format?


thomasW wrote:


The first one is because Zend_Date ignores all other parts except 
numbers.

The date parsing is actually not as strict as for strings.
To have a strict date parsing you would simply have to validate it as
string, for example with a fixed length.
A true from isDate does only mean that Zend_Date can handle this date 
with

the given format, it does not mean that the input format is strictly
identical.
Zend_Date can fix much notations automatically. This is the reason why it
returns true even if you may not have expected this.

But why should the second one be a wrong format ?
The year 1005 exists, the Month 09 exists and the day 01 exists.
It is very far in the past ut still this is a valid date.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Kexiao Liao [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Wednesday, October 15, 2008 4:20 PM
Subject: [fw-general] Zend_Date to validate input date format




I use Zend_Date class to validate the input date format as showing below

Zend_Date::isDate ( $value, '-M-d' )

However the following input date values CAN NOT BE detected as wrong
format
2003--10-1
1005-09-01

Is this a bug for Zend_Date class? Please give your comments. Thanks.

Kevin


--
View this message in context:
http://www.nabble.com/Zend_Date-to-validate-input-date-format-tp19994516p19994516.html
Sent from the Zend Framework mailing list archive at Nabble.com.






--
View this message in context: 
http://www.nabble.com/Zend_Date-to-validate-input-date-format-tp19994516p19995235.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date: floating times, partial values

2008-10-02 Thread Nilesh Govindrajan
-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


Re: [fw-general] Zend_Date

2008-09-29 Thread Thomas Weidner

How about simple date-maths like learned in old school ?

Set the week, then set the weekday...
$date-setWeek(40)-setWeekday('Monday');

for example.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Matthias Buesing [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Monday, September 29, 2008 3:57 PM
Subject: [fw-general] Zend_Date



Hello,
i have a question about Zend_Date.

Is it possible to calculate the first day (Monday) of a specific Week
in a Year?

For example: I want to find out the date of the Monday from
Calendarweek 40 in 2008. (It has to be 29.09.08)

Greets
Matthias Buesing


Re: [fw-general] Zend_Date issue when try to return a date using the toString method, ZF 1.5.2

2008-09-02 Thread Juan Felipe Alvarez Saldarriaga
Create dates with $part = Zend_Date::ISO_8601 when comes from the database:

... new Zend_Date( 2008-08-29 17:30:00, Zend_Date::ISO_8601 ) ...

... new Zend_Date( 2008-09-01 08:25:00, Zend_Date::ISO_8601 ) ...

- Original Message -
From: Juan Felipe Alvarez Saldarriaga [EMAIL PROTECTED]
To: fw-general fw-general@lists.zend.com
Sent: Tuesday, September 2, 2008 3:48:27 PM GMT -05:00 Columbia
Subject: [fw-general] Zend_Date issue when try to return a date using the 
toString method, ZF 1.5.2

Hey!

I got this code: (http://paste2.org/p/69212)

$objAppointments = new Appointments();

$return = $objAppointments-filter( new Zend_Config( array(
objDateStart = new Zend_Date( 2008-08-29 17:30:00 ),
objDateEnd = new Zend_Date( 2008-09-01 08:25:00 )
) ) );

// Inside Appointments::filter method.
Zend_Date::setOptions( array( format_type = php ) );

$dateEnd = $objArguments-objDateEnd-toString( Y-m-d H:i:s )

$dateStart = $objArguments-objDateStart-toString( Y-m-d H:i:s )

// string(19) 2008-01-09 08:25:00, see the month and the day? the day is in 
place of the moneht and the month in the day.
Zend_Debug::dump( $dateEnd );

// string(19) 2008-08-29 17:30:00
Zend_Debug::dump( $dateStart );

Why month and day are wrong in $dateEnd ?

Thx for any help.


Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )

2008-08-10 Thread Thomas Weidner

Hy Bruno,

why do you think this is a problem ?
Each locale defines the dateformats in a different way.

And you defined to return the default date/time format from this locale.
Btw: Using DATE_FULL as input where no input is given is quite useless. It 
will be ignored. ;-)


And when you want to have a fixed outputformat you should define it.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Bruno Friedmann [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Sunday, August 10, 2008 11:15 AM
Subject: [fw-general] Zend_Date + Zend_Locale bug ( missing translation 
localisation ? )



Hi all

While working on date I've found a strange result ( ZF is 1.6.0RC1 but same 
result with 1.5.3 )


$date['en'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en');
$date['en_US'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_US');
$date['en_GB'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_GB');
$date['fr'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr');
$date['fr_FR'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_FR');
$date['fr_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_CH');
$date['de'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de');
$date['de_DE'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_DE');
$date['de_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_CH');
$date['it'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it');
$date['it_IT'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_IT');
$date['it_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_CH');

echo divpre;
foreach ($date as $key = $value){
print $key .\t = \t .$value-getDate($key) .\n;
}
echo /pre/div;



result
en = Aug 10, 2008 1:00:00 AM
en_US = Aug 10, 2008 1:00:00 AM
en_GB = 10 Aug 2008 01:00:00
fr = 10 août 2008 01:00:00
fr_FR = 10 août 2008 01:00:00
fr_CH = 10 août 2008 01:00:00
de = 10.08.2008 01:00:00
de_DE = 10.08.2008 01:00:00
de_CH = 10.08.2008 01:00:00
it = 10/ago/2008 01:00:00
it_IT = 10/ago/2008 01:00:00
it_CH = 10-ago-2008 01:00:00


As you can see, there's a trouble with all the DE and associated languages.
(I've check all files de.xml and so are present in the library directory and 
readble and have right content.


Could someone confirm and / or explain me what I'm doing wrong.

Also if someone could give me the instruction to have only the date without 
the time..

I've try what is explain here.
http://framework.zend.com/manual/en/zend.date.constants.html
Table 9.15. Date and Time Formats (format varies by locale)



--

 Bruno Friedmann 



Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )

2008-08-10 Thread Bruno Friedmann

Thomas Weidner wrote:

Hy Bruno,

why do you think this is a problem ?
Each locale defines the dateformats in a different way.


OK I have learn that. But my real concern is why I don't get the translation 
for DE, de_DE, de_CH ?



And you defined to return the default date/time format from this locale.
Btw: Using DATE_FULL as input where no input is given is quite useless. 
It will be ignored. ;-)

I have misunderstood the documentation I'm thinking that if I don't give it 
automatically use time();



And when you want to have a fixed outputformat you should define it.


That's exactly why I ask a localized format ;-)
Otherwise the old php date would be sufficient no ?


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Bruno Friedmann [EMAIL PROTECTED]
To: fw-general@lists.zend.com
Sent: Sunday, August 10, 2008 11:15 AM
Subject: [fw-general] Zend_Date + Zend_Locale bug ( missing translation 
localisation ? )



Hi all

While working on date I've found a strange result ( ZF is 1.6.0RC1 but 
same result with 1.5.3 )


$date['en'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en');
$date['en_US'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_US');
$date['en_GB'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'en_GB');
$date['fr'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr');
$date['fr_FR'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_FR');
$date['fr_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'fr_CH');
$date['de'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de');
$date['de_DE'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_DE');
$date['de_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'de_CH');
$date['it'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it');
$date['it_IT'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_IT');
$date['it_CH'] = new Zend_Date(null,Zend_Date::DATE_FULL, 'it_CH');

echo divpre;
foreach ($date as $key = $value){
print $key .\t = \t .$value-getDate($key) .\n;
}
echo /pre/div;



result
en = Aug 10, 2008 1:00:00 AM
en_US = Aug 10, 2008 1:00:00 AM
en_GB = 10 Aug 2008 01:00:00
fr = 10 août 2008 01:00:00
fr_FR = 10 août 2008 01:00:00
fr_CH = 10 août 2008 01:00:00
de = 10.08.2008 01:00:00
de_DE = 10.08.2008 01:00:00
de_CH = 10.08.2008 01:00:00
it = 10/ago/2008 01:00:00
it_IT = 10/ago/2008 01:00:00
it_CH = 10-ago-2008 01:00:00


As you can see, there's a trouble with all the DE and associated languages.
(I've check all files de.xml and so are present in the library directory 
and readble and have right content.


Could someone confirm and / or explain me what I'm doing wrong.

Also if someone could give me the instruction to have only the date 
without the time..

I've try what is explain here.
http://framework.zend.com/manual/en/zend.date.constants.html
Table 9.15. Date and Time Formats (format varies by locale)






--

 Bruno Friedmann

Ioda-Net Sàrl   - www.ioda-net.ch
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760

C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com



Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )

2008-08-10 Thread Thomas Weidner

Hy Bruno,


Each locale defines the dateformats in a different way.
OK I have learn that. But my real concern is why I don't get the 
translation for DE, de_DE, de_CH ?


You did not ask for an output in a localized format.


And you defined to return the default date/time format from this locale.
Btw: Using DATE_FULL as input where no input is given is quite useless. 
It will be ignored. ;-)
have misunderstood the documentation I'm thinking that if I don't give it 
automatically use time();


It uses time(), but why did you define DATE_FULL as input.. when you ask for 
the actual time as input it is useless to define another inputformat because 
time() will be caught as timestamp.



And when you want to have a fixed outputformat you should define it.

That's exactly why I ask a localized format ;-)
Otherwise the old php date would be sufficient no ?


No, you did not ask for a localized format.
You just asked for the date returned as object without time. Look at the API 
doc of the methods you used.
Using __toString in an inplicit way does not mean that the date is 
localized.
This depends on the default format of the used locale. And german does not 
include a localized month in the default format.


There is no error.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com 



Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )

2008-08-10 Thread Bruno Friedmann

Sorry to bother you Master of Local  Date.

How should I call Zend_Date to have the following result for the actual time
Donnerstag, 10. August 2008
That not indicate in doc not in api ( no sample given)
Addition  substract etc are present, but no sample code.



Thomas Weidner wrote:

Hy Bruno,


Each locale defines the dateformats in a different way.
OK I have learn that. But my real concern is why I don't get the 
translation for DE, de_DE, de_CH ?


You did not ask for an output in a localized format.

And you defined to return the default date/time format from this 
locale.
Btw: Using DATE_FULL as input where no input is given is quite 
useless. It will be ignored. ;-)
have misunderstood the documentation I'm thinking that if I don't give 
it automatically use time();


It uses time(), but why did you define DATE_FULL as input.. when you ask 
for the actual time as input it is useless to define another inputformat 
because time() will be caught as timestamp.



And when you want to have a fixed outputformat you should define it.

That's exactly why I ask a localized format ;-)
Otherwise the old php date would be sufficient no ?


No, you did not ask for a localized format.
You just asked for the date returned as object without time. Look at the 
API doc of the methods you used.
Using __toString in an inplicit way does not mean that the date is 
localized.
This depends on the default format of the used locale. And german does 
not include a localized month in the default format.


There is no error.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com



--

 Bruno Friedmann

Ioda-Net Sàrl   - www.ioda-net.ch
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760

C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com



Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation localisation ? )

2008-08-10 Thread Thomas Weidner

There are exmples:
Look into the manual into chapter Zend_Date,
http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.selfdefinedformats

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


- Original Message - 
From: Bruno Friedmann [EMAIL PROTECTED]

Cc: fw-general@lists.zend.com
Sent: Sunday, August 10, 2008 9:11 PM
Subject: Re: [fw-general] Zend_Date + Zend_Locale bug ( missing translation 
localisation ? )



Sorry to bother you Master of Local  Date.

How should I call Zend_Date to have the following result for the actual time
Donnerstag, 10. August 2008
That not indicate in doc not in api ( no sample given)
Addition  substract etc are present, but no sample code.



Thomas Weidner wrote:

Hy Bruno,


Each locale defines the dateformats in a different way.
OK I have learn that. But my real concern is why I don't get the 
translation for DE, de_DE, de_CH ?


You did not ask for an output in a localized format.

And you defined to return the default date/time format from this 
locale.
Btw: Using DATE_FULL as input where no input is given is quite useless. 
It will be ignored. ;-)
have misunderstood the documentation I'm thinking that if I don't give it 
automatically use time();


It uses time(), but why did you define DATE_FULL as input.. when you ask 
for the actual time as input it is useless to define another inputformat 
because time() will be caught as timestamp.



And when you want to have a fixed outputformat you should define it.

That's exactly why I ask a localized format ;-)
Otherwise the old php date would be sufficient no ?


No, you did not ask for a localized format.
You just asked for the date returned as object without time. Look at the 
API doc of the methods you used.
Using __toString in an inplicit way does not mean that the date is 
localized.
This depends on the default format of the used locale. And german does not 
include a localized month in the default format.


There is no error.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com



--

 Bruno Friedmann

Ioda-Net Sàrl   - www.ioda-net.ch
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760

C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com 



Re: [fw-general] Zend_Date Problems

2008-08-05 Thread Thomas Weidner

I think, if format not specify timezone, this shoud not verify it.


This is not true.
A date/timestamp always include a timezone EXCEPT you specify UTC or GMT as 
timezone.

If you dont specify one, it will detect it automatically.

When you have problems please try always with the latest available release.
When this does not help, please add a issue to jira adding description, and 
reproducable code so we can fix the problem.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Haroldo MM [EMAIL PROTECTED]

To: ZF General List fw-general@lists.zend.com
Sent: Tuesday, August 05, 2008 4:37 PM
Subject: [fw-general] Zend_Date Problems



Hi!

I new here, and not speak english very well.

So, I have some problems using Zend_Date, i don't know
but year 2038 is not valid, i think some related to timestamp
limit or locate, or I not using Zend_Date correct way.

CODE:

//date_default_timezone_set ( 'America/New_York' );
//$locale  = new Zend_Locale( 'en_US' );
date_default_timezone_set ( 'America/Sao_Paulo' );
$locale  = new Zend_Locale( 'pt_BR' );

function isValidDate( $value, $locale  ) {
   if ( Zend_Date::isDate( $value, 'MM-dd-', $locale ) )  echo 
$value: Is Valid br/;

   else echo $value: Is NOT Valid br/;
}

isValidDate( '01-01-2008', $locale ); // Return 01-01-2008: Is Valid 
isValidDate( '01-01-2020', $locale ); // Return 01-01-2020: Is Valid 
isValidDate( '01-01-2037', $locale ); // Return 01-01-2037: Is Valid 
isValidDate( '01-01-2038', $locale ); // Return 01-01-2038: Is NOT Valid 
isValidDate( '01-01-2039', $locale ); // Return 01-01-2039: Is Valid 
isValidDate( '01-01-3000', $locale ); // Return 01-01-3000: Is Valid 
isValidDate( '01-01-0001', $locale ); // Return 01-01-0001: Is Valid

---

When I change locale and time zone to en_US:America/New_York, year 2038
become valid, I make tests changing format 'MM-dd-' to my reginal 
format 'dd-MM-', or switching 'y' to 'Y', and still get problem.


Another thing I want know, is there some option to make Zend_Date
not 'try' detect time zone from date string, this generate some warnings
because of @. I use error_handler to get errors, and when my application
go to production, normaly I set display_errors off, and send errors by 
email.


CODE:

$zDate = new Zend_Date('01.01.2008', 'dd.MM.', 'en_US');
print $zDate-getIso();
//
//[Warning]Zend\Date\DateObject.php:1016 timezone_open(): Unknown or bad 
timezone (2009)

//[Cause] if ([EMAIL PROTECTED]($zone)) { //
---

I think, if format not specify timezone, this shoud not verify it.

Thanks.


--
Haroldo Mitsumi Murata [K33]





Re: [fw-general] Zend_Date Problems

2008-08-05 Thread Haroldo MM


Sory about code, my email client cause some problens when copy/paste 
unix end lines.

About relase, I using ZF 1.5.3.

I solved my problem puting year limit on my application, tanks.

The Simplfied Code is:

date_default_timezone_set ( 'America/Sao_Paulo' );
$locale  = new Zend_Locale( 'pt_BR' );

if ( Zend_Date::isDate( '01-01-2038', 'dd-MM-', $locale ) ) {
   echo Is Valid;
} else {
   echo Is NOT Valid;
}



Haroldo Mitsumi Murata [K33]


Thomas Weidner escreveu:

I think, if format not specify timezone, this shoud not verify it.


This is not true.
A date/timestamp always include a timezone EXCEPT you specify UTC or 
GMT as timezone.

If you dont specify one, it will detect it automatically.

When you have problems please try always with the latest available 
release.
When this does not help, please add a issue to jira adding 
description, and reproducable code so we can fix the problem.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: Haroldo MM [EMAIL PROTECTED]
To: ZF General List fw-general@lists.zend.com
Sent: Tuesday, August 05, 2008 4:37 PM
Subject: [fw-general] Zend_Date Problems



Hi!

I new here, and not speak english very well.

So, I have some problems using Zend_Date, i don't know
but year 2038 is not valid, i think some related to timestamp
limit or locate, or I not using Zend_Date correct way.

CODE:

//date_default_timezone_set ( 'America/New_York' );
//$locale  = new Zend_Locale( 'en_US' );
date_default_timezone_set ( 'America/Sao_Paulo' );
$locale  = new Zend_Locale( 'pt_BR' );

function isValidDate( $value, $locale  ) {
   if ( Zend_Date::isDate( $value, 'MM-dd-', $locale ) )  echo 
$value: Is Valid br/;

   else echo $value: Is NOT Valid br/;
}

isValidDate( '01-01-2008', $locale ); // Return 01-01-2008: Is Valid 
isValidDate( '01-01-2020', $locale ); // Return 01-01-2020: Is Valid 
isValidDate( '01-01-2037', $locale ); // Return 01-01-2037: Is Valid 
isValidDate( '01-01-2038', $locale ); // Return 01-01-2038: Is NOT 
Valid isValidDate( '01-01-2039', $locale ); // Return 01-01-2039: Is 
Valid isValidDate( '01-01-3000', $locale ); // Return 01-01-3000: Is 
Valid isValidDate( '01-01-0001', $locale ); // Return 01-01-0001: Is 
Valid

---

When I change locale and time zone to en_US:America/New_York, year 2038
become valid, I make tests changing format 'MM-dd-' to my reginal 
format 'dd-MM-', or switching 'y' to 'Y', and still get problem.


Another thing I want know, is there some option to make Zend_Date
not 'try' detect time zone from date string, this generate some warnings
because of @. I use error_handler to get errors, and when my application
go to production, normaly I set display_errors off, and send errors 
by email.


CODE:

$zDate = new Zend_Date('01.01.2008', 'dd.MM.', 'en_US');
print $zDate-getIso();
//
//[Warning]Zend\Date\DateObject.php:1016 timezone_open(): Unknown or 
bad timezone (2009)

//[Cause] if ([EMAIL PROTECTED]($zone)) { //
---

I think, if format not specify timezone, this shoud not verify it.

Thanks.


--
Haroldo Mitsumi Murata [K33]





Re: [fw-general] Zend_Date problem with add/subMonth()

2008-07-01 Thread fab2008

Bingo!!

I found my mistake, I set timezone with date_default_timezone_set in my
bootstrap file with the timezone of production server, but I develop on my
laptop which has a different timezone.

What a stupid mistake ;-)

Thanks for helping me.

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18220722.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Thomas Weidner

Please give the full iso representation as output. (getIso())
All other outputs are useless as they miss needed informations which are not 
provided in your text.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: fab2008 [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Monday, June 30, 2008 3:08 AM
Subject: [fw-general] Zend_Date problem with add/subMonth()




I'm writing a caledar script for managing orders. I want to implement an 
iCal

like interface for operators, so i created a calendar class; among its
methods I have two methods, getPreviousLink and getNextLink() that point 
to

previous and next month. When I create an object of this class, if no day
parameter is passed, I create an empty Zend_Date representig current date.
Howewer when I build links using Zend_Date::addMonth() and subMonth() I 
get
a very strange (for me) behaviour, i created some test code to reproduce 
the

problem:

Zend_Debug::dump(adding months);
$a = new Zend_Date();
Zend_Debug::dump($a-toString());
for ($i = 0; $i  24; $i++) {
$a-addMonth(1);
Zend_Debug::dump($a-toString());
}
Zend_Debug::dump(subtracting months);
$a = new Zend_Date();
for ($i = 0; $i  24; $i++) {
$a-subMonth(1);
Zend_Debug::dump($a-toString());
}

the result for this code is:

string(20) 29/giu/2008 20:56:13

string(12) adding months
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
...
string(18) subtracting months
string(20) 01/mag/2008 21:02:38
string(20) 01/mar/2008 21:02:38
string(20) 01/gen/2008 21:02:38
string(20) 01/nov/2007 21:02:38
string(20) 01/set/2007 21:02:38
string(20) 01/lug/2007 21:02:38
string(20) 01/mag/2007 21:02:38
string(20) 01/mar/2007 21:02:38
...

Is this a bug or i misunderstood Zend_Date::add/subMonth() function?

Can anyone help me?

P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5


--
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread fab2008

You're right, here is the iso output (with the same code as above), but the
result is the same :-(

When I add months the date remains unchanged (except for the first add), and
when I subtracting subMonth() subtract two months every step, I'm pretty
confused

string(25) 2008-06-30T08:57:04-04:00

string(13) adding months
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
...
string(18) subtracting months
string(25) 2008-05-01T08:57:04-04:00
string(25) 2008-03-01T08:57:04-05:00
string(25) 2008-01-01T08:57:04-05:00
string(25) 2007-11-01T08:57:04-04:00
string(25) 2007-09-01T08:57:04-04:00
string(25) 2007-07-01T08:57:04-04:00
string(25) 2007-05-01T08:57:04-04:00
string(25) 2007-03-01T08:57:04-05:00
string(25) 2007-01-01T08:57:04-05:00
string(25) 2006-11-01T08:57:04-05:00
string(25) 2006-09-01T08:57:04-04:00
...


thomasW wrote:
 
 Please give the full iso representation as output. (getIso())
 All other outputs are useless as they miss needed informations which are
 not 
 provided in your text.
 
 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com
 
 - Original Message - 
 From: fab2008 [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Monday, June 30, 2008 3:08 AM
 Subject: [fw-general] Zend_Date problem with add/subMonth()
 
 

 I'm writing a caledar script for managing orders. I want to implement an 
 iCal
 like interface for operators, so i created a calendar class; among its
 methods I have two methods, getPreviousLink and getNextLink() that point 
 to
 previous and next month. When I create an object of this class, if no day
 parameter is passed, I create an empty Zend_Date representig current
 date.
 Howewer when I build links using Zend_Date::addMonth() and subMonth() I 
 get
 a very strange (for me) behaviour, i created some test code to reproduce 
 the
 problem:

 Zend_Debug::dump(adding months);
 $a = new Zend_Date();
 Zend_Debug::dump($a-toString());
 for ($i = 0; $i  24; $i++) {
 $a-addMonth(1);
 Zend_Debug::dump($a-toString());
 }
 Zend_Debug::dump(subtracting months);
 $a = new Zend_Date();
 for ($i = 0; $i  24; $i++) {
 $a-subMonth(1);
 Zend_Debug::dump($a-toString());
 }

 the result for this code is:

 string(20) 29/giu/2008 20:56:13

 string(12) adding months
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 ...
 string(18) subtracting months
 string(20) 01/mag/2008 21:02:38
 string(20) 01/mar/2008 21:02:38
 string(20) 01/gen/2008 21:02:38
 string(20) 01/nov/2007 21:02:38
 string(20) 01/set/2007 21:02:38
 string(20) 01/lug/2007 21:02:38
 string(20) 01/mag/2007 21:02:38
 string(20) 01/mar/2007 21:02:38
 ...

 Is this a bug or i misunderstood Zend_Date::add/subMonth() function?

 Can anyone help me?

 P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5


 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Thomas Weidner

Fab,

Testing your code with the input you gave (timezone, timestamp), I got not 
your output.

Every month is returned as expected.

You have three possibilities:

1.) Use the extended_month option as stated in the manual
2.) Update to the actual release
3.) Install the trunk version

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: fab2008 [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Monday, June 30, 2008 3:02 PM
Subject: Re: [fw-general] Zend_Date problem with add/subMonth()




You're right, here is the iso output (with the same code as above), but 
the

result is the same :-(

When I add months the date remains unchanged (except for the first add), 
and

when I subtracting subMonth() subtract two months every step, I'm pretty
confused

string(25) 2008-06-30T08:57:04-04:00

string(13) adding months
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
...
string(18) subtracting months
string(25) 2008-05-01T08:57:04-04:00
string(25) 2008-03-01T08:57:04-05:00
string(25) 2008-01-01T08:57:04-05:00
string(25) 2007-11-01T08:57:04-04:00
string(25) 2007-09-01T08:57:04-04:00
string(25) 2007-07-01T08:57:04-04:00
string(25) 2007-05-01T08:57:04-04:00
string(25) 2007-03-01T08:57:04-05:00
string(25) 2007-01-01T08:57:04-05:00
string(25) 2006-11-01T08:57:04-05:00
string(25) 2006-09-01T08:57:04-04:00
...


thomasW wrote:


Please give the full iso representation as output. (getIso())
All other outputs are useless as they miss needed informations which are
not
provided in your text.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: fab2008 [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Monday, June 30, 2008 3:08 AM
Subject: [fw-general] Zend_Date problem with add/subMonth()




I'm writing a caledar script for managing orders. I want to implement an
iCal
like interface for operators, so i created a calendar class; among its
methods I have two methods, getPreviousLink and getNextLink() that point
to
previous and next month. When I create an object of this class, if no 
day

parameter is passed, I create an empty Zend_Date representig current
date.
Howewer when I build links using Zend_Date::addMonth() and subMonth() I
get
a very strange (for me) behaviour, i created some test code to reproduce
the
problem:

Zend_Debug::dump(adding months);
$a = new Zend_Date();
Zend_Debug::dump($a-toString());
for ($i = 0; $i  24; $i++) {
$a-addMonth(1);
Zend_Debug::dump($a-toString());
}
Zend_Debug::dump(subtracting months);
$a = new Zend_Date();
for ($i = 0; $i  24; $i++) {
$a-subMonth(1);
Zend_Debug::dump($a-toString());
}

the result for this code is:

string(20) 29/giu/2008 20:56:13

string(12) adding months
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
string(20) 01/lug/2008 20:56:13
...
string(18) subtracting months
string(20) 01/mag/2008 21:02:38
string(20) 01/mar/2008 21:02:38
string(20) 01/gen/2008 21:02:38
string(20) 01/nov/2007 21:02:38
string(20) 01/set/2007 21:02:38
string(20) 01/lug/2007 21:02:38
string(20) 01/mag/2007 21:02:38
string(20) 01/mar/2007 21:02:38
...

Is this a bug or i misunderstood Zend_Date::add/subMonth() function?

Can anyone help me?

P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5


--
View this message in context:
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
Sent from the Zend Framework mailing list archive at Nabble.com.






--
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Michael Depetrillo
This is a definite bug with Zend_Date that no one wants to admit.

Use the config option 'extended_month' = true to use Excel style date
addition/subtraction.

On Mon, Jun 30, 2008 at 6:02 AM, fab2008 [EMAIL PROTECTED] wrote:


 You're right, here is the iso output (with the same code as above), but the
 result is the same :-(

 When I add months the date remains unchanged (except for the first add),
 and
 when I subtracting subMonth() subtract two months every step, I'm pretty
 confused

 string(25) 2008-06-30T08:57:04-04:00

 string(13) adding months
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 string(25) 2008-07-01T08:57:04-04:00
 ...
 string(18) subtracting months
 string(25) 2008-05-01T08:57:04-04:00
 string(25) 2008-03-01T08:57:04-05:00
 string(25) 2008-01-01T08:57:04-05:00
 string(25) 2007-11-01T08:57:04-04:00
 string(25) 2007-09-01T08:57:04-04:00
 string(25) 2007-07-01T08:57:04-04:00
 string(25) 2007-05-01T08:57:04-04:00
 string(25) 2007-03-01T08:57:04-05:00
 string(25) 2007-01-01T08:57:04-05:00
 string(25) 2006-11-01T08:57:04-05:00
 string(25) 2006-09-01T08:57:04-04:00
 ...


 thomasW wrote:
 
  Please give the full iso representation as output. (getIso())
  All other outputs are useless as they miss needed informations which are
  not
  provided in your text.
 
  Greetings
  Thomas Weidner, I18N Team Leader, Zend Framework
  http://www.thomasweidner.com
 
  - Original Message -
  From: fab2008 [EMAIL PROTECTED]
  To: fw-general@lists.zend.com
  Sent: Monday, June 30, 2008 3:08 AM
  Subject: [fw-general] Zend_Date problem with add/subMonth()
 
 
 
  I'm writing a caledar script for managing orders. I want to implement an
  iCal
  like interface for operators, so i created a calendar class; among its
  methods I have two methods, getPreviousLink and getNextLink() that point
  to
  previous and next month. When I create an object of this class, if no
 day
  parameter is passed, I create an empty Zend_Date representig current
  date.
  Howewer when I build links using Zend_Date::addMonth() and subMonth() I
  get
  a very strange (for me) behaviour, i created some test code to reproduce
  the
  problem:
 
  Zend_Debug::dump(adding months);
  $a = new Zend_Date();
  Zend_Debug::dump($a-toString());
  for ($i = 0; $i  24; $i++) {
  $a-addMonth(1);
  Zend_Debug::dump($a-toString());
  }
  Zend_Debug::dump(subtracting months);
  $a = new Zend_Date();
  for ($i = 0; $i  24; $i++) {
  $a-subMonth(1);
  Zend_Debug::dump($a-toString());
  }
 
  the result for this code is:
 
  string(20) 29/giu/2008 20:56:13
 
  string(12) adding months
  string(20) 01/lug/2008 20:56:13
  string(20) 01/lug/2008 20:56:13
  string(20) 01/lug/2008 20:56:13
  string(20) 01/lug/2008 20:56:13
  string(20) 01/lug/2008 20:56:13
  ...
  string(18) subtracting months
  string(20) 01/mag/2008 21:02:38
  string(20) 01/mar/2008 21:02:38
  string(20) 01/gen/2008 21:02:38
  string(20) 01/nov/2007 21:02:38
  string(20) 01/set/2007 21:02:38
  string(20) 01/lug/2007 21:02:38
  string(20) 01/mag/2007 21:02:38
  string(20) 01/mar/2007 21:02:38
  ...
 
  Is this a bug or i misunderstood Zend_Date::add/subMonth() function?
 
  Can anyone help me?
 
  P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5
 
 
  --
  View this message in context:
 
 http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
AIM: klassicd

www.michaeldepetrillo.com


Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Thomas Weidner

Michael,

when you are getting a reply to your issue from an developer you should also 
answer or give any other response when you it's not solved.
You have been said that your issue has been fixed within the trunk r9450 
which was 6 weeks ago.
But you did not respond so it seems to us that all works like expected. And 
you have not reopened the issue.


Also to say, that your issue is not the same as fab's. You are both just 
using the same function which does not imply the same error.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Michael Depetrillo [EMAIL PROTECTED]

To: fab2008 [EMAIL PROTECTED]
Cc: fw-general@lists.zend.com
Sent: Monday, June 30, 2008 8:04 PM
Subject: Re: [fw-general] Zend_Date problem with add/subMonth()



This is a definite bug with Zend_Date that no one wants to admit.

Use the config option 'extended_month' = true to use Excel style date
addition/subtraction.

On Mon, Jun 30, 2008 at 6:02 AM, fab2008 [EMAIL PROTECTED] wrote:



You're right, here is the iso output (with the same code as above), but 
the

result is the same :-(

When I add months the date remains unchanged (except for the first add),
and
when I subtracting subMonth() subtract two months every step, I'm pretty
confused

string(25) 2008-06-30T08:57:04-04:00

string(13) adding months
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
string(25) 2008-07-01T08:57:04-04:00
...
string(18) subtracting months
string(25) 2008-05-01T08:57:04-04:00
string(25) 2008-03-01T08:57:04-05:00
string(25) 2008-01-01T08:57:04-05:00
string(25) 2007-11-01T08:57:04-04:00
string(25) 2007-09-01T08:57:04-04:00
string(25) 2007-07-01T08:57:04-04:00
string(25) 2007-05-01T08:57:04-04:00
string(25) 2007-03-01T08:57:04-05:00
string(25) 2007-01-01T08:57:04-05:00
string(25) 2006-11-01T08:57:04-05:00
string(25) 2006-09-01T08:57:04-04:00
...


thomasW wrote:

 Please give the full iso representation as output. (getIso())
 All other outputs are useless as they miss needed informations which 
 are

 not
 provided in your text.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message -
 From: fab2008 [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Monday, June 30, 2008 3:08 AM
 Subject: [fw-general] Zend_Date problem with add/subMonth()



 I'm writing a caledar script for managing orders. I want to implement 
 an

 iCal
 like interface for operators, so i created a calendar class; among its
 methods I have two methods, getPreviousLink and getNextLink() that 
 point

 to
 previous and next month. When I create an object of this class, if no
day
 parameter is passed, I create an empty Zend_Date representig current
 date.
 Howewer when I build links using Zend_Date::addMonth() and subMonth() 
 I

 get
 a very strange (for me) behaviour, i created some test code to 
 reproduce

 the
 problem:

 Zend_Debug::dump(adding months);
 $a = new Zend_Date();
 Zend_Debug::dump($a-toString());
 for ($i = 0; $i  24; $i++) {
 $a-addMonth(1);
 Zend_Debug::dump($a-toString());
 }
 Zend_Debug::dump(subtracting months);
 $a = new Zend_Date();
 for ($i = 0; $i  24; $i++) {
 $a-subMonth(1);
 Zend_Debug::dump($a-toString());
 }

 the result for this code is:

 string(20) 29/giu/2008 20:56:13

 string(12) adding months
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 string(20) 01/lug/2008 20:56:13
 ...
 string(18) subtracting months
 string(20) 01/mag/2008 21:02:38
 string(20) 01/mar/2008 21:02:38
 string(20) 01/gen/2008 21:02:38
 string(20) 01/nov/2007 21:02:38
 string(20) 01/set/2007 21:02:38
 string(20) 01/lug/2007 21:02:38
 string(20) 01/mag/2007 21:02:38
 string(20) 01/mar/2007 21:02:38
 ...

 Is this a bug or i misunderstood Zend_Date::add/subMonth() function?

 Can anyone help me?

 P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5


 --
 View this message in context:

http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




--
View this message in context:
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
Sent from the Zend Framework mailing list archive at Nabble.com.





--
Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
AIM: klassicd

www.michaeldepetrillo.com





Re: [fw-general] Zend_Date::isDate issue

2008-06-12 Thread Thomas Weidner

Juan,

your code is wrong as you set the message for non-formatted dates but set a 
format before. Also you are using the ISO year instead of the real year. 
Could be problematic as long as you are not using as calendar 
representation.


Related to isDate:
There is a year 80 BC so it states that the date is correct.
Zend_Date does only check if the date is correct, it does not check if the 
string is identical as this is useless for dates...


yy is automatically converted to  (the leading zeros are suppressed).
Also for dates it is not relevant which seperator you are using... even if 
it's not / as declared by you, you will get a true as a date can be found 
which fit's the format.
Keep in mind that Zend_Date can automatically detect the date and isDate 
does exactly reflect this. Why should isDate throw an error when the format 
can be detected ? :-)


When you need a fixtation of string like if 2 digits are set and a / 
seperator then just add a validator which checks the string format 
additionally to the date.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Juan Felipe Alvarez Saldarriaga [EMAIL PROTECTED]

To: fw-general fw-general@lists.zend.com
Sent: Thursday, June 12, 2008 12:30 AM
Subject: [fw-general] Zend_Date::isDate issue



Hello! :)

I have an issue with Zend_Date, I mean, I'm using Zend_Form and creating a 
Validator for a element date, so I have this:


$objValidateDate = new Zend_Validate_Date( MM/dd/ );
$objValidateDate-setMessage( '%value%' is not of the format MM/DD/, 
Zend_Validate_Date::NOT__MM_DD );

$objElement-addValidator( $objValidateDate );

So, I don't know wich format use, so I test the isDate method from 
Zend_Date, then I have this:


Zend_Debug::dump( Zend_Date::isDate( 10/10/80, MM/dd/ ) );

Look the format, I'm using the ISO table of constants, and look at the 
return of Zend_Debug::dump:


bool(true)

How can return true if the year have just two digits (10/10/80) ? and my 
format have four (MM/dd/) ?


Thx for any help. 




Re: [fw-general] Zend_Date::isDate issue

2008-06-12 Thread Juan Felipe Alvarez Saldarriaga
Hey Thomas!

Thx for the reply, yea, yesterday I figure it out the same, I was talking with 
the guys at #zftalk and DASPRiD told me the same, isDate doesn't check the 
string thing, thx for your help ^^.

- Original Message -
From: Thomas Weidner [EMAIL PROTECTED]
To: fw-general fw-general@lists.zend.com
Sent: Thursday, June 12, 2008 1:21:57 AM GMT -05:00 Columbia
Subject: Re: [fw-general] Zend_Date::isDate issue

Juan,

your code is wrong as you set the message for non-formatted dates but set a 
format before. Also you are using the ISO year instead of the real year. 
Could be problematic as long as you are not using as calendar 
representation.

Related to isDate:
There is a year 80 BC so it states that the date is correct.
Zend_Date does only check if the date is correct, it does not check if the 
string is identical as this is useless for dates...

yy is automatically converted to  (the leading zeros are suppressed).
Also for dates it is not relevant which seperator you are using... even if 
it's not / as declared by you, you will get a true as a date can be found 
which fit's the format.
Keep in mind that Zend_Date can automatically detect the date and isDate 
does exactly reflect this. Why should isDate throw an error when the format 
can be detected ? :-)

When you need a fixtation of string like if 2 digits are set and a / 
seperator then just add a validator which checks the string format 
additionally to the date.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Juan Felipe Alvarez Saldarriaga [EMAIL PROTECTED]
To: fw-general fw-general@lists.zend.com
Sent: Thursday, June 12, 2008 12:30 AM
Subject: [fw-general] Zend_Date::isDate issue


 Hello! :)

 I have an issue with Zend_Date, I mean, I'm using Zend_Form and creating a 
 Validator for a element date, so I have this:

 $objValidateDate = new Zend_Validate_Date( MM/dd/ );
 $objValidateDate-setMessage( '%value%' is not of the format MM/DD/, 
 Zend_Validate_Date::NOT__MM_DD );
 $objElement-addValidator( $objValidateDate );

 So, I don't know wich format use, so I test the isDate method from 
 Zend_Date, then I have this:

 Zend_Debug::dump( Zend_Date::isDate( 10/10/80, MM/dd/ ) );

 Look the format, I'm using the ISO table of constants, and look at the 
 return of Zend_Debug::dump:

 bool(true)

 How can return true if the year have just two digits (10/10/80) ? and my 
 format have four (MM/dd/) ?

 Thx for any help. 



Re: [fw-general] [Zend_Date] getting next sunday's date

2008-06-12 Thread Thomas Weidner
Just use simple math... see the following example. It should give you a 
feeling:


$date = new Zend_Date();
$date-setTime('00:00:00');
$date-setDay(0);
$date-addDay(7);

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Olivier Ricordeau [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Thursday, June 12, 2008 11:48 AM
Subject: [fw-general] [Zend_Date] getting next sunday's date



Hi list,

Is there a way to get the date that corresponds to next sunday at midnight 
using Zend_Date?


Cheers,
Olivier

--
- *Olivier RICORDEAU* -
 [EMAIL PROTECTED] 




Re: [fw-general] Zend_date Confusion

2008-05-29 Thread Thomas Weidner

I am not able to reproduce your problem...
Using your examplecode I get:
Apr 2008
Mai 2008
Jun 2008

which is what I would expect when adding 1 month 3 times.
Maybe you are using a outdated release ?

Update your ZF version to the actual release (1.5.2) or trunk version.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


- Original Message - 
From: aztechy [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Thursday, May 29, 2008 6:41 PM
Subject: [fw-general] Zend_date Confusion




Hello all,

So I've been playing around with Zend_Date to get a feel for it but the
expected behavior of addMonth/subMonth aren't what I expect.  Here's an
example of just some simple testing that doesn't output what I would 
expect.


Create a previous month, current month, next month display:

php
date_default_timezone_set('America/Los_Angeles');
$date = Zend_Date::now();  // For this example this returns May 29, 2008
some time

// print prev month
$date-subMonth(1);
print $date-toString(MMM );  // Expected display: April.  Actual
Result April - Good

// print current month
$date-addMonth(1);
print $date-toString(MMM ); // Expected display: May.  Actual 
Result:

April - Odd?

// print next month
$date-addMonth(1);
print $date-toString(MMM ); // Expected display: May, Actual 
Result:

April - Odd?
?

I found that if I want to return back to the current month, in this case
May, after subtracting a single month I would instead have to do
'$date-addMonth(2);' and make the same call again to advance to the next
month (June).

Is this the way that I am supposed to work with zend date to advance up 
and

down the months or am I just doing things wrong?

Thanks ahead for any assistance.
--
View this message in context: 
http://www.nabble.com/Zend_date-Confusion-tp17540531p17540531.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date help

2008-05-28 Thread debussy007

Now I finally got it working, since I specified locale 'en_US'
Probably it didn't recognize 'Jan', I think there should be an exception in
such cases.



debussy007 wrote:
 
 Hi,
 
 I try to convert a string representing a date into a zend date object.
 (It is the format date returned by paypal)
 
   $zd = new Zend_Date(18:30:30 Jan 1, 2000, 'HH:mm:ss MMM d, ');
   echo  $zd-get('-MM-dd H:m:s');
 
 This prints:  1975-06-23 18:30:30
 So the year, month and date are wrong.
 
 Thank you for any help !
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-help-tp17508292p17511620.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date help

2008-05-28 Thread Thomas Weidner

Why should there be an exception...
Looking into the doc it says that IF YOU SUPRESS THE LOCALE it will 
autodetect it, which means that it uses the one from your browser or from 
your server.


Only when no locale can be detected there will be an exception thrown.

Greetings
Thomas
I18N Team Leader

- Original Message - 
From: debussy007 [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Wednesday, May 28, 2008 2:33 PM
Subject: Re: [fw-general] Zend_Date help




Now I finally got it working, since I specified locale 'en_US'
Probably it didn't recognize 'Jan', I think there should be an exception 
in

such cases.



debussy007 wrote:


Hi,

I try to convert a string representing a date into a zend date object.
(It is the format date returned by paypal)

$zd = new Zend_Date(18:30:30 Jan 1, 2000, 'HH:mm:ss MMM d, ');
echo  $zd-get('-MM-dd H:m:s');

This prints:  1975-06-23 18:30:30
So the year, month and date are wrong.

Thank you for any help !



--
View this message in context: 
http://www.nabble.com/Zend_Date-help-tp17508292p17511620.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date and GMT problem

2008-03-19 Thread holografix .
Hi

You need to add Zend_Date::setOptions(array('extend_month' = true));
before doing month calculation.

best regards,
holo


2008/3/18, tflessak [EMAIL PROTECTED]:

  Hi,

  I mean the method subMonth doesn't subtract 5 months correctly. For example
  (my timezone is Sao Paulo/Brazil):


  date_default_timezone_set('America/Sao_Paulo');

 $dt = new Zend_Date();
  $dt-subMonth(5);

 $result = $dt-toString('dd/MM/');

  On version 1.0.3 $result is the current date minus 5 months (18/10/2007). On
  version 1.0.4 and 1.5 $result is always the first day of the month, in that
  case, 18/03/2008 - 5 months = 01/10/2007.
  I didn't set any specific Zend_Date option.

  Thank you





  thomasW wrote:
  
   Hy Thiago,
  
   please provide us with all informations...
  
   What do you mean with the code does not work anymore ?
   When I run your code it works without problems.
  
   Which timezone have you set ? ... it's not declared in your example.
   What is the date-time you executed it ?
   What was the result ?
   What did you expect to be returned ?
   Did you set any options before initiation ?
  
   Greetings
   Thomas Weidner, I18N Team Leader
   http://www.thomasweidner.com
  
   - Original Message -
   From: tflessak [EMAIL PROTECTED]
   To: fw-general@lists.zend.com
   Sent: Tuesday, March 18, 2008 4:05 PM
   Subject: [fw-general] Zend_Date and GMT problem
  
  
  
   Hi!
  
   I was using Zend Framework 1.0.3
   Into my code there are situations where I use some month calculation like
   this:
  
   $dt = new Zend_Date();
   $dt-subMonth(5);
  
   After update to version 1.5, this code doesn't work anymore.
   Doing some comparison with version 1.0.3, I could see that the function
   which manipulates the month calculation includes the function
   'DateObject::mktime' it has a boolean parameter called 'gmt'. On version
   1.0.3, internally this parameter was false when I call the functions
   'subMonth' ou 'addMonth'. On version 1.0.4 and 1.5 the 'gmt' parameter
   passed to true and consequently internally the 'DateObject::mktime' use
   the
   php function gmmktime.
   I'm having problems after this modification, because the gmmktime is
   returning me a wrong date. I tried this code:
  
   date_default_timezone_set('America/Sao_Paulo');
   $dategmt =  @gmmktime(0, 0, 0, 3, 18, 2008);
   $datemk = @mktime(0, 0, 0, 3, 18, 2008);
  
   ... and the return of gmmktime is 3 hour less then mktime, and the date
   get
   back to the day before.
  
   My question is: Am I doing something wrong? Somebody knows the reason of
   why
   the gmmktime is used instead mktime on version 1.0.4 and 1.5 ?
  
   Thank you for help!
   Regards
   Thiago
   --
   View this message in context:
   
 http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16122102.html
   Sent from the Zend Framework mailing list archive at Nabble.com.
  
  
  

  --

 View this message in context: 
 http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16126515.html

 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend_Date and GMT problem

2008-03-18 Thread Thomas Weidner

Hy Thiago,

please provide us with all informations...

What do you mean with the code does not work anymore ?
When I run your code it works without problems.

Which timezone have you set ? ... it's not declared in your example.
What is the date-time you executed it ?
What was the result ?
What did you expect to be returned ?
Did you set any options before initiation ?

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

- Original Message - 
From: tflessak [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Tuesday, March 18, 2008 4:05 PM
Subject: [fw-general] Zend_Date and GMT problem




Hi!

I was using Zend Framework 1.0.3
Into my code there are situations where I use some month calculation like
this:

$dt = new Zend_Date();
$dt-subMonth(5);

After update to version 1.5, this code doesn't work anymore.
Doing some comparison with version 1.0.3, I could see that the function
which manipulates the month calculation includes the function
'DateObject::mktime' it has a boolean parameter called 'gmt'. On version
1.0.3, internally this parameter was false when I call the functions
'subMonth' ou 'addMonth'. On version 1.0.4 and 1.5 the 'gmt' parameter
passed to true and consequently internally the 'DateObject::mktime' use 
the

php function gmmktime.
I'm having problems after this modification, because the gmmktime is
returning me a wrong date. I tried this code:

date_default_timezone_set('America/Sao_Paulo');
$dategmt =  @gmmktime(0, 0, 0, 3, 18, 2008);
$datemk = @mktime(0, 0, 0, 3, 18, 2008);

... and the return of gmmktime is 3 hour less then mktime, and the date 
get

back to the day before.

My question is: Am I doing something wrong? Somebody knows the reason of 
why

the gmmktime is used instead mktime on version 1.0.4 and 1.5 ?

Thank you for help!
Regards
Thiago
--
View this message in context: 
http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16122102.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date and GMT problem

2008-03-18 Thread tflessak

Hi,

I mean the method subMonth doesn't subtract 5 months correctly. For example
(my timezone is Sao Paulo/Brazil):

date_default_timezone_set('America/Sao_Paulo');
$dt = new Zend_Date();
$dt-subMonth(5);
$result = $dt-toString('dd/MM/');

On version 1.0.3 $result is the current date minus 5 months (18/10/2007). On
version 1.0.4 and 1.5 $result is always the first day of the month, in that
case, 18/03/2008 - 5 months = 01/10/2007.
I didn't set any specific Zend_Date option.

Thank you




thomasW wrote:
 
 Hy Thiago,
 
 please provide us with all informations...
 
 What do you mean with the code does not work anymore ?
 When I run your code it works without problems.
 
 Which timezone have you set ? ... it's not declared in your example.
 What is the date-time you executed it ?
 What was the result ?
 What did you expect to be returned ?
 Did you set any options before initiation ?
 
 Greetings
 Thomas Weidner, I18N Team Leader
 http://www.thomasweidner.com
 
 - Original Message - 
 From: tflessak [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Tuesday, March 18, 2008 4:05 PM
 Subject: [fw-general] Zend_Date and GMT problem
 
 

 Hi!

 I was using Zend Framework 1.0.3
 Into my code there are situations where I use some month calculation like
 this:

 $dt = new Zend_Date();
 $dt-subMonth(5);

 After update to version 1.5, this code doesn't work anymore.
 Doing some comparison with version 1.0.3, I could see that the function
 which manipulates the month calculation includes the function
 'DateObject::mktime' it has a boolean parameter called 'gmt'. On version
 1.0.3, internally this parameter was false when I call the functions
 'subMonth' ou 'addMonth'. On version 1.0.4 and 1.5 the 'gmt' parameter
 passed to true and consequently internally the 'DateObject::mktime' use 
 the
 php function gmmktime.
 I'm having problems after this modification, because the gmmktime is
 returning me a wrong date. I tried this code:

 date_default_timezone_set('America/Sao_Paulo');
 $dategmt =  @gmmktime(0, 0, 0, 3, 18, 2008);
 $datemk = @mktime(0, 0, 0, 3, 18, 2008);

 ... and the return of gmmktime is 3 hour less then mktime, and the date 
 get
 back to the day before.

 My question is: Am I doing something wrong? Somebody knows the reason of 
 why
 the gmmktime is used instead mktime on version 1.0.4 and 1.5 ?

 Thank you for help!
 Regards
 Thiago
 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16122102.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16126515.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date::__toString throwing exception

2008-02-06 Thread Thomas Weidner

Hy Jason,

I haven't seen the error you gave here in past.
Any exception thrown by Zend_Date which you've mentioned before prints out 
the real reason.


In my opinion your error has nothing to do with Zend_Date but depends on 
another component or a generic php failure.
It looks like you are handling the exception yourself... in this case we 
would need the real exception message.
Also we would need the real file and line if it's a Zend_Date error to 
verify it.


Best would be to set a new jira issue with all available data.

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

- Original Message - 
From: Jason Austin [EMAIL PROTECTED]

To: fw-general fw-general@lists.zend.com
Sent: Wednesday, February 06, 2008 8:12 PM
Subject: [fw-general] Zend_Date::__toString throwing exception



Howdy list...

I am having an issue where Zend_Date::__toString is causing an exception 
where it shouldn't be.  The error I get is


Fatal error: Method Zend_Date::__toString() must not throw an exception in 
/my/file/path on line 54


This has just started happening since upgrading our webserver to apache 
2.2 with php 5.2.5 and is not consistent (we're using 1.0.3 of the 
framework).  It only happens once in a while.
After a bit of searching I found this article 
(http://framework.zend.com/wiki/display/ZFDEV/6.+Anonymous+Sessions) that 
mentions at the end that it may be xpath related, occuring when 
Zend_Local_Data reads the data file in a wrong way.  However, it doesn't 
mention how to solve it.  Anyone got any ideas?


Thanks
Jason Austin
NC State University 




Re: [fw-general] Zend_Date print in 1.5 Preview Release

2008-02-02 Thread Thomas Weidner

1.5 will be build from trunk... so this is no problem.

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

- Original Message - 
From: Bradley Holt [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Saturday, February 02, 2008 7:13 PM
Subject: [fw-general] Zend_Date print in 1.5 Preview Release



In the 1.5 preview release, Zend_Date has a print statement on line 2157
which is being hit when I construct a new Zend_Date. It looks like this 
has
been removed in trunk. I just wanted to make sure this made it into 1.5 
(or

didn't make it in, as the case may be).

--
Bradley Holt
[EMAIL PROTECTED]





Re: [fw-general] Zend_Date print in 1.5 Preview Release

2008-02-02 Thread Bradley Holt
OK, great, thank you!

On Feb 2, 2008 1:45 PM, Thomas Weidner [EMAIL PROTECTED] wrote:

 1.5 will be build from trunk... so this is no problem.

 Greetings
 Thomas Weidner, I18N Team Leader
 http://www.thomasweidner.com

 - Original Message -
 From: Bradley Holt [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Saturday, February 02, 2008 7:13 PM
 Subject: [fw-general] Zend_Date print in 1.5 Preview Release


  In the 1.5 preview release, Zend_Date has a print statement on line 2157
  which is being hit when I construct a new Zend_Date. It looks like this
  has
  been removed in trunk. I just wanted to make sure this made it into 1.5
  (or
  didn't make it in, as the case may be).
 
  --
  Bradley Holt
  [EMAIL PROTECTED]
 




-- 
Bradley Holt
[EMAIL PROTECTED]


Re: [fw-general] Zend_Date chaining methods

2007-10-06 Thread Thomas Weidner

Hy Yann,

chaining would make no sense for Zend_Date.
Most methods return a textual date or date value.

And setTimezone which you wrote in your example is even not member of 
Zend_Date but of it's SuperClass.

It would not be possible to return the actual Zend_Date with this method.

But there are a few methods which do return a date object for example all 
detail functions like

getDate, setDate, addDate, subDate, and others.

Greetings
Thomas


- Original Message - 
From: Yann Nave [EMAIL PROTECTED]

To: Zend Framework General fw-general@lists.zend.com
Sent: Saturday, October 06, 2007 3:44 PM
Subject: [fw-general] Zend_Date chaining methods



Is there some issue to have chaining methods in Zend_Date ?

Like :

$date = new Zend_date;
$date-set()-setTimezone();
etc..

--
Yannux
http://blog.onbebop.net 




Re: [fw-general] Zend_Date convert GMT to local timezone

2007-10-04 Thread Wolfgang Forstmeier
Hey Yann,

you should have a look to the manual,
there is something you are looking for.

http://framework.zend.com/manual/en/zend.date.additional.html#zend.date.additional.timezones

On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
 Hye,

 It' a little mess for me yo understand how to convert date betwenn GMT
 and Europe/Paris for example.

 Field form my DB is like :  2007-08-03 19:54   ( GMT )
 I would like to convert  it in user's Timezone (like Europe/Paris).

 How can I do it ?

 --
 Yannux
 http://blog.onbebop.net



-- 
Mit freundlichen Grüßen
With best regards

Wolfgang Forstmeier
---
+49° 34' 26.76, +11° 0' 48.60
---
mailto:[EMAIL PROTECTED]


Re: [fw-general] Zend_Date convert GMT to local timezone

2007-10-04 Thread Noé Froidevaux
Hi,

with the php class date no?

http://www.php.net/date

--
Noé

On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
 Hye,

 It' a little mess for me yo understand how to convert date betwenn GMT
 and Europe/Paris for example.

 Field form my DB is like :  2007-08-03 19:54   ( GMT )
 I would like to convert  it in user's Timezone (like Europe/Paris).

 How can I do it ?

 --
 Yannux
 http://blog.onbebop.net



Re: [fw-general] Zend_Date convert GMT to local timezone

2007-10-04 Thread Yann Nave
But -MM-dd hh:mm  isnt' ISO format :s Just Mysql Datetime... :s
On 10/4/07, Wolfgang Forstmeier [EMAIL PROTECTED] wrote:
 Hey Yann,

 you should have a look to the manual,
 there is something you are looking for.

 http://framework.zend.com/manual/en/zend.date.additional.html#zend.date.additional.timezones

 On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
  Hye,
 
  It' a little mess for me yo understand how to convert date betwenn GMT
  and Europe/Paris for example.
 
  Field form my DB is like :  2007-08-03 19:54   ( GMT )
  I would like to convert  it in user's Timezone (like Europe/Paris).
 
  How can I do it ?
 
  --
  Yannux
  http://blog.onbebop.net
 


 --
 Mit freundlichen Grüßen
 With best regards

 Wolfgang Forstmeier
 ---
 +49° 34' 26.76, +11° 0' 48.60
 ---
 mailto:[EMAIL PROTECTED]



-- 
Yannux
http://blog.onbebop.net


Re: [fw-general] Zend_Date convert GMT to local timezone

2007-10-04 Thread Noé Froidevaux
Date('c'); - ISO 8601

On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
 But -MM-dd hh:mm  isnt' ISO format :s Just Mysql Datetime... :s
 On 10/4/07, Wolfgang Forstmeier [EMAIL PROTECTED] wrote:
  Hey Yann,
 
  you should have a look to the manual,
  there is something you are looking for.
 
  http://framework.zend.com/manual/en/zend.date.additional.html#zend.date.additional.timezones
 
  On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
   Hye,
  
   It' a little mess for me yo understand how to convert date betwenn GMT
   and Europe/Paris for example.
  
   Field form my DB is like :  2007-08-03 19:54   ( GMT )
   I would like to convert  it in user's Timezone (like Europe/Paris).
  
   How can I do it ?
  
   --
   Yannux
   http://blog.onbebop.net
  
 
 
  --
  Mit freundlichen Grüßen
  With best regards
 
  Wolfgang Forstmeier
  ---
  +49° 34' 26.76, +11° 0' 48.60
  ---
  mailto:[EMAIL PROTECTED]
 


 --
 Yannux
 http://blog.onbebop.net



Re: [fw-general] Zend_Date convert GMT to local timezone

2007-10-04 Thread Yann Nave
Ok so Thanks for your help. FInally I try this :

 date_default_timezone_set('GMT');

// create a date object
echo 'Mysql Datetime (GMT insert) : ';
echo $mysql_datetime_gmt= '2007-10-03 19:10';

// false parameter because it's Mysql Datetime format...
$date = new Zend_Date($mysql_datetime_gmt, false, 'fr');

// view our date object
echo 'br /Zend_Date::getIso : '.$date-getIso();
// what timezone do we have ?
echo 'br /Zend_Date::getTimezone : '. $date-getTimezone();

echo 'br /br /Change Timezone to Europe/Paris';
// set another timezone
$date-setTimezone('Europe/Paris');

// what timezone do we now have ?
echo 'br /Zend_Date::getTimezone : '. $date-getTimezone();
// see the changed date object
echo 'br /Zend_Date::getIso : '.$date-getIso();


And I get :
Mysql Datetime (GMT insert) : 2007-10-03 19:10
Zend_Date::getIso : 2007-10-03T19:10:00+00:00
Zend_Date::getTimezone : GMT

Change Timezone to Europe/Paris
Zend_Date::getTimezone : Europe/Paris
Zend_Date::getIso : 2007-10-03T21:10:00+02:00

So good :)



On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
 But -MM-dd hh:mm  isnt' ISO format :s Just Mysql Datetime... :s
 On 10/4/07, Wolfgang Forstmeier [EMAIL PROTECTED] wrote:
  Hey Yann,
 
  you should have a look to the manual,
  there is something you are looking for.
 
  http://framework.zend.com/manual/en/zend.date.additional.html#zend.date.additional.timezones
 
  On 10/4/07, Yann Nave [EMAIL PROTECTED] wrote:
   Hye,
  
   It' a little mess for me yo understand how to convert date betwenn GMT
   and Europe/Paris for example.
  
   Field form my DB is like :  2007-08-03 19:54   ( GMT )
   I would like to convert  it in user's Timezone (like Europe/Paris).
  
   How can I do it ?
  
   --
   Yannux
   http://blog.onbebop.net
  
 
 
  --
  Mit freundlichen Grüßen
  With best regards
 
  Wolfgang Forstmeier
  ---
  +49° 34' 26.76, +11° 0' 48.60
  ---
  mailto:[EMAIL PROTECTED]
 


 --
 Yannux
 http://blog.onbebop.net



-- 
Yannux
http://blog.onbebop.net


Re: [fw-general] Zend_Date and gmt

2007-09-24 Thread Thomas Weidner

???
$date-setTimezone('GMT');

Just take a look in the manual...

Greetings
Thomas
I18N Team Leader


- Original Message - 
From: Yann Nave [EMAIL PROTECTED]

To: Zend Framework General fw-general@lists.zend.com
Sent: Monday, September 24, 2007 1:59 PM
Subject: [fw-general] Zend_Date and gmt



How to get date in gmt format with Zend_Date ?? :s

--
Yannux
http://blog.onbebop.net


Re: [fw-general] Zend_Date and MySQL datetime

2007-09-21 Thread Tobias Gies
Hi list,

Before DB-specific code is added to the i18n components, why don't we do it
the other way round and simply add about 5 lines of code in the abstract or
concrete database adapters, to allow them to accept an instance of Zend_Date
as parameter for a query and simply turn it into the date format that best
fits the corresponding database?

just a thought.

Greetings,
Tobias

2007/9/20, Thomas Weidner [EMAIL PROTECTED]:

 We can not integrate all just for fun...
 The more we integrate the slower will Zend_Date work.

 It would be no problem to have interfaces integrated for the best xx
 databases. (mssql, mysql, oracle, postgres, dbm2, sqlite,...)
 But this would mean to include about 100-200 new lines of code.
 Because when we decide to add db-dependence code we should do it for all
 db
 formats and not only for mysql.

 If you think it's worth doing feel free to add an jira issue and we will
 discuss it in the dev-team.

 Greetings
 Thomas
 I18N Team Leader


 - Original Message -
 From: Dale McNeill [EMAIL PROTECTED]
 Cc: Zend Framework General fw-general@lists.zend.com
 Sent: Thursday, September 20, 2007 8:56 PM
 Subject: Re: [fw-general] Zend_Date and MySQL datetime


  Thomas -
 
  It would certainly make sense to add an interface/constant to aid in
  getting a MySQL compatible string.  Seems like one of the more, if not
 the
  most, common output usages.
 
  Dale
 
  Thomas Weidner wrote:
  Hy,
 
  you are wrong...
  The manual does not state that getIso() creates MySql Syntax.
 
  It is written that you can use all ISO formats as input for Zend_Date.
  As there are over 50 different ISO formats it would be nonsense to
 define
  as much constants.
 
  But creating an non-standard Zend_Date output is also very easy...
  Instead of getIso() just use
  toString('-MM-dd HH:mm:ss');
  and you have your self defined output.
 
  Greetings
  Thomas
  I18N Team Leader
 
  - Original Message - From: Jack Sleight
  [EMAIL PROTECTED]
  To: Zend Framework General fw-general@lists.zend.com
  Sent: Thursday, September 20, 2007 7:38 PM
  Subject: [fw-general] Zend_Date and MySQL datetime
 
 
  Hi,
  The ZF manual states that for MySQL datetime values you can use the
  Zend_Date::ISO_8601 format, and the $date-getIso() method. It is true
  that if you parse in a date from a MySQL field with the ISO 8601
 format
  constant it will work, but strictly speaking they are not (correctly)
  ISO 8601 formatted. This becomes a problem when trying to save a date
  into the database, because the value returned by $date-getIso() is
 not
  accepted by MySQL, and it throws an error (Incorrect datetime value:
  '2007-09-20T18:36:59+01:00'). The correct format for a MySQL datetime
  string is -MM-dd HH:mm:ss.
 
  Could we add this as a new constant in Zend_Date?
  --
  Jack
 
 
  --
  
  Dale McNeill  |
  Alchemy Systems   | phone: (512) 532-8050
  http://www.alchemysystems.com | email: [EMAIL PROTECTED]
  




Re: [fw-general] Zend_Date and MySQL datetime

2007-09-21 Thread Thomas Weidner

This could be done without heavy additions...
Each Adapter would just have to know it's specific date format.
f.e. $dateformat = -MM-dd HH:mm:ss for MySQL or -MM-ddTHH:mm:ss 
for MsSQL and so on...


Just add an issue to jira and it will be discussed within the dev-team.

Greetings
Thomas
I18N Team Leader


- Original Message - 
From: Tobias Gies [EMAIL PROTECTED]

To: Zend Framework General fw-general@lists.zend.com
Sent: Friday, September 21, 2007 3:44 PM
Subject: Re: [fw-general] Zend_Date and MySQL datetime



Hi list,

Before DB-specific code is added to the i18n components, why don't we do 
it
the other way round and simply add about 5 lines of code in the abstract 
or
concrete database adapters, to allow them to accept an instance of 
Zend_Date

as parameter for a query and simply turn it into the date format that best
fits the corresponding database?

just a thought.

Greetings,
Tobias

2007/9/20, Thomas Weidner [EMAIL PROTECTED]:


We can not integrate all just for fun...
The more we integrate the slower will Zend_Date work.

It would be no problem to have interfaces integrated for the best xx
databases. (mssql, mysql, oracle, postgres, dbm2, sqlite,...)
But this would mean to include about 100-200 new lines of code.
Because when we decide to add db-dependence code we should do it for all
db
formats and not only for mysql.

If you think it's worth doing feel free to add an jira issue and we will
discuss it in the dev-team.

Greetings
Thomas
I18N Team Leader


- Original Message -
From: Dale McNeill [EMAIL PROTECTED]
Cc: Zend Framework General fw-general@lists.zend.com
Sent: Thursday, September 20, 2007 8:56 PM
Subject: Re: [fw-general] Zend_Date and MySQL datetime


 Thomas -

 It would certainly make sense to add an interface/constant to aid in
 getting a MySQL compatible string.  Seems like one of the more, if not
the
 most, common output usages.

 Dale

 Thomas Weidner wrote:
 Hy,

 you are wrong...
 The manual does not state that getIso() creates MySql Syntax.

 It is written that you can use all ISO formats as input for Zend_Date.
 As there are over 50 different ISO formats it would be nonsense to
define
 as much constants.

 But creating an non-standard Zend_Date output is also very easy...
 Instead of getIso() just use
 toString('-MM-dd HH:mm:ss');
 and you have your self defined output.

 Greetings
 Thomas
 I18N Team Leader

 - Original Message - From: Jack Sleight
 [EMAIL PROTECTED]
 To: Zend Framework General fw-general@lists.zend.com
 Sent: Thursday, September 20, 2007 7:38 PM
 Subject: [fw-general] Zend_Date and MySQL datetime


 Hi,
 The ZF manual states that for MySQL datetime values you can use the
 Zend_Date::ISO_8601 format, and the $date-getIso() method. It is 
 true

 that if you parse in a date from a MySQL field with the ISO 8601
format
 constant it will work, but strictly speaking they are not (correctly)
 ISO 8601 formatted. This becomes a problem when trying to save a date
 into the database, because the value returned by $date-getIso() is
not
 accepted by MySQL, and it throws an error (Incorrect datetime value:
 '2007-09-20T18:36:59+01:00'). The correct format for a MySQL datetime
 string is -MM-dd HH:mm:ss.

 Could we add this as a new constant in Zend_Date?
 --
 Jack


 --
 
 Dale McNeill  |
 Alchemy Systems   | phone: (512) 532-8050
 http://www.alchemysystems.com | email: [EMAIL PROTECTED]
 








  1   2   >