473,490 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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
Oct 10 '08 #1
1 3020
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3370
by: Gustavo G. Rondina | last post by:
It is possible to caclulate every year's easter using simple mathematical operations. Here is a code that does the trick: http://www.brlivre.org/c/easter.c I found the math scheme in an...
1
3077
by: plaforest | last post by:
Hello All, Thank you for your thoughtful consideration. I am running Access 2000 (9.0.3821 SR-1) This query works: SELECT , FROM table1
4
4147
by: bretonlais | last post by:
I am creating a scheduling application which will allow users to schedule recurring tasks, e.g., the user can set a task to run (M,T,W) or (M,T,W,TH,F,S) etc. I want binary encode each day of the...
7
2780
by: Muddasir | last post by:
Hi everyone I want to set timezone (US/Central). It is working fine on my local computer but when I upload the code on web server It is giving me error Fatal error: Call to undefined function:...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.