Questions tagged [zend-date]
64 questions
14
votes
6 answers
PHP Zend date format
I want to input a timestamp in below format to the database.
yyyy-mm-dd hh:mm:ss
How can I get in above format?
When I use
$date = new Zend_Date();
it returns month dd, yyyy hh:mm:ss PM
I also use a JavaScript calender to insert a selected date…

maniclorn
- 1,081
- 3
- 12
- 23
9
votes
6 answers
Zend Date -- day difference
I have the below line of codes
$day1 = new Zend_Date('2010-03-01', 'YYYY-mm-dd');
$day2 = new Zend_Date('2010-03-05', 'YYYY-mm-dd');
$dateDiff = $day2->getDate()->get(Zend_Date::TIMESTAMP) - $day1->getDate()->get(Zend_Date::TIMESTAMP);
$days =…

Nisanth Kumar
- 5,667
- 8
- 33
- 43
7
votes
1 answer
Zend_Date::toString() outputs the wrong year. Bug in my code, or Zend_Date?
I'm using Zend_Date to set and get the year, but it is not being set as the correct year. I set the year as 2010, and it returns the year as 2009. What am I doing wrong? Is there a bug in Zend_Date?
$date = new Zend_Date('2010-01-03',…

Andrew
- 227,796
- 193
- 515
- 708
5
votes
1 answer
How to compare the date parts of two Zend_Date objects?
I'd like to check if to Zend_Date datetimes are on the same day. How can I do that?
$date1 = new Zend_Date('2011-11-14 10:45:00');
$date2 = new Zend_Date('2011-11-14 19:15:00');

BenMorel
- 34,448
- 50
- 182
- 322
5
votes
2 answers
Bug in Zend_Date (back in time)
I have a very strange problem, Zend_Date is converting my timestamp to a year earlier.
In my action:
// Timestamp
$intTime = 1293922800;
// Zend_Date object
$objZendDate = new Zend_Date($intTime);
// Get date
echo…

Jeroen Weustink
- 51
- 2
5
votes
1 answer
Zend_Date: How to get the date of an upcoming day?
I want to get the date of the closest Monday in the future (i.e. not in the past).
So if today is Tuesday (Dec 1, 2009) I want to get the date of Monday (Dec 7, 2009).
How can I do this with Zend_Date?
Solution:
Let's say today is Tuesday and we…

Andrew
- 227,796
- 193
- 515
- 708
4
votes
2 answers
Zend_Date: wrong results on DST change day
"25 Mar 2012" was the date when time was changed from 02:00am to 03:00am in the Czech Republic. On that date, one functionality on my website stopped working correctly and a customer complained, etc. After digging for a few hours, I figured out that…

clime
- 8,695
- 10
- 61
- 82
4
votes
2 answers
Check valid date in zend framework
I am using zend framework 1.12.0 and i have a value fetching from database to be validated.
That is if its a date value then i have to change the format into YYYY-MM-DD to MM/DD/YYYY.Else i keep the value as ''.I am using the following code
…

웃웃웃웃웃
- 11,829
- 15
- 59
- 91
3
votes
3 answers
Bug with Zend_Date calculating subtraction two date
I write this function:
public function calcDifferentDate($dateStart, $dateEnd = false, $output = Zend_Date::DAY)
{
$dateEnd = $dateEnd ? $dateEnd : Zend_Date::now()->toString('YYYY-MM-dd');
$dateStartZD = new Zend_Date($dateStart,…

JellyBelly
- 2,451
- 2
- 21
- 41
3
votes
1 answer
First day of each month
If I start with the current date, how can I get the first Friday of each month?
I was thinking about using $date->get(Zend::WEEKDAY) and comparing that to Friday and then with DAY and checking if it is less than or equal to 7. Then adding 1 month…

Sam French
- 705
- 1
- 5
- 10
3
votes
1 answer
Work Around for Zend Date DST Bug
I discovered a bug in Zend_Date when setting a time that crosses the DST change.
Here's code that illustrates the problem:
date_default_timezone_set('America/New_York');
echo '
'; // DST BEGINS '2012-03-11 02:00:00' - "Spring Forward" $a = new…

Sonny
- 8,204
- 7
- 63
- 134
3
votes
1 answer
Zend Jalali Date
Does Zend support jalali date and calendar?
And How can i get that ?
I tried this:
$locale = new Zend_Locale('fa_IR');
$date = new Zend_Date();
$new_date= Zend_Locale_Format::getDate($date,
array(
'date_format'…

R.
- 2,818
- 26
- 37
3
votes
3 answers
How can I simply change the Timezone Offset with Zend_Date?
I'm using Zend_Date to manage dates/times in a scheduling app.
The only way I'm able to determine the user's Timezone is via Javascript which only gives a Timezone Offset. Zend_Date only seems to take Timezones in the 'America/New_York' format.
Is…

Nicky Hajal
- 1,584
- 1
- 15
- 23
3
votes
3 answers
How to create a datetime validator in a Zend Framework form?
By default a Zend Framework date validator uses the date format yyyy-MM-dd:
$dateValidator = new Zend_Validate_Date();
But I want to add hour and minute validation. In other words, I want to require the user to enter the hour and minute. But the…

Andrew
- 227,796
- 193
- 515
- 708
3
votes
2 answers
Automatically selecting dates from databases as Zend_Date objects
From what I understand, the best way to deal with dates in the Zend Framework is to select them as a Unix timestamp from the database.
Quick Creation of Dates from Database Date Values
// SELECT UNIX_TIMESTAMP(my_datetime_column) FROM my_table
$date…

asgeo1
- 9,028
- 6
- 63
- 85