By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

date_create

P: n/a
I'm porting some perl (a calendar) over to php and I have some date
questions.

What I'd like to do is feed in a month and year and get the number of
days in the month and the starting day of the week.

The date function does this:

$day_of_week = date('w',$unix_timestamp);
$days_in_month = date('t',$unix_timestamp);

Now, I don't know how to get the timestamp easily.

I thought I could do this:

$date_obj = date_create();
date_date_set($date_obj,$year,$month,1);

But I don't know how to get the timestamp out of the date_obj. What's
the function for that?

Is there an easier way to do this?

Perl is a bit erratic in how it indexes months and years. I didn't see
much in the docs but:

Is the month "1" indexed (ie, January is 1)?
Is the day also 1 index?
Is the year a 4 digit year?

That would be sensible which is not the case in Perl!

Jeff
Oct 10 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Message-ID: <Q8******************************@earthlink.comfro m Jeff
contained the following:
>The date function does this:

$day_of_week = date('w',$unix_timestamp);
$days_in_month = date('t',$unix_timestamp);

Now, I don't know how to get the timestamp easily.
http://uk.php.net/date
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk - http://4theweb.co.uk
Oct 10 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.