Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old October 10th, 2008, 07:15 AM
Jeff
Guest
 
Posts: n/a
Default date_create

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
  #2  
Old October 10th, 2008, 08:15 AM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: date_create

Message-ID: <Q8Wdnd8W-L4lbXPVnZ2dnUVZ_uGdnZ2d@earthlink.comfrom Jeff
contained the following:
Quote:
>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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles