473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Display previous month


Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.

Many thanks
Sam

Nov 5 '07 #1
10 15949
sa*****@hotmail.com wrote:
Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.

Many thanks
Sam

Sam,

I'm not sure what you're asking for. Can you clarify this a little more?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 5 '07 #2
On 5 Nov, 12:57, Jerry Stuckle <jstuck...@attglobal.netwrote:
samh...@hotmail.com wrote:
Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.
Many thanks
Sam

Sam,

I'm not sure what you're asking for. Can you clarify this a little more?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Jerry,

I am looking for a simple piece of PHP code that will write the
previous month in full.
So for example, if it was used now, it would display the text
'October'.
If it was used in April, it would display 'March', etc.
Sorry I wasn't very clear.

Thanks
Sam

Nov 5 '07 #3
sa*****@hotmail.com wrote:
On 5 Nov, 12:57, Jerry Stuckle <jstuck...@attglobal.netwrote:
>samh...@hotmail.com wrote:
>>Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.
Many thanks
Sam
Sam,

I'm not sure what you're asking for. Can you clarify this a little more?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Jerry,

I am looking for a simple piece of PHP code that will write the
previous month in full.
So for example, if it was used now, it would display the text
'October'.
If it was used in April, it would display 'March', etc.
Sorry I wasn't very clear.

Thanks
Sam

OK, maybe something like:

echo date("F",strtotime("-1 month"));

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 5 '07 #4
sa*****@hotmail.com wrote:
On 5 Nov, 12:57, Jerry Stuckle <jstuck...@attglobal.netwrote:
>samh...@hotmail.com wrote:
>>Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.
Many thanks
Sam
Sam,

I'm not sure what you're asking for. Can you clarify this a little more?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Jerry,

I am looking for a simple piece of PHP code that will write the
previous month in full.
So for example, if it was used now, it would display the text
'October'.
If it was used in April, it would display 'March', etc.
Sorry I wasn't very clear.

Thanks
Sam

Nope, that one fails on March 31st, for instance.

How about:

echo date("F",strtotime(-date('j') . ' days'));

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 5 '07 #5
On 5 Nov, 14:42, Jerry Stuckle <jstuck...@attglobal.netwrote:
samh...@hotmail.com wrote:
On 5 Nov, 12:57, Jerry Stuckle <jstuck...@attglobal.netwrote:
samh...@hotmail.com wrote:
Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.
Many thanks
Sam
Sam,
I'm not sure what you're asking for. Can you clarify this a little more?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Jerry,
I am looking for a simple piece of PHP code that will write the
previous month in full.
So for example, if it was used now, it would display the text
'October'.
If it was used in April, it would display 'March', etc.
Sorry I wasn't very clear.
Thanks
Sam

Nope, that one fails on March 31st, for instance.

How about:

echo date("F",strtotime(-date('j') . ' days'));

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
Seems to work fine. Many thanks for your help.

Nov 5 '07 #6
Greetings, Jerry Stuckle.
In reply to Your message dated Monday, November 5, 2007, 17:42:13,
echo date("F",strtotime(-date('j') . ' days'));
Another piece of ***:

date('F', mktime(1, 1, 1, date('m')-1, 1, date('Y')));

;)
--
Sincerely Yours, AnrDaemon <an*******@freemail.ru>

Nov 6 '07 #7
AnrDaemon wrote:
Greetings, Jerry Stuckle.
In reply to Your message dated Monday, November 5, 2007, 17:42:13,
>echo date("F",strtotime(-date('j') . ' days'));

Another piece of ***:

date('F', mktime(1, 1, 1, date('m')-1, 1, date('Y')));

;)

Yours fails in January.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 6 '07 #8
On 5 nov, 13:22, samh...@hotmail.com wrote:
Hopefully an easy one. Can someone please supply me with the code for
displaying the previous month?
I do not want just -3 from December for October. It needs to work each
month without modifying.

Many thanks
Sam
The PHP manual gives some solutions. Maybe this one will work:
http://nl3.php.net/manual/nl/function.mktime.php#53662

Nov 6 '07 #9
Greetings, Jerry Stuckle.
In reply to Your message dated Tuesday, November 6, 2007, 08:28:20,
AnrDaemon wrote:
>Greetings, Jerry Stuckle.
In reply to Your message dated Monday, November 5, 2007, 17:42:13,
>>echo date("F",strtotime(-date('j') . ' days'));

Another piece of ***:

date('F', mktime(1, 1, 1, date('m')-1, 1, date('Y')));

;)

Yours fails in January.
Check it before posting such silliness.

<?php

echo date('D d F, Y', mktime(1, 1, 1, 0, 1, 2007));

?>

Intended answer:
Fri 01 December, 2006
--
Sincerely Yours, AnrDaemon <an*******@freemail.ru>

Nov 6 '07 #10
AnrDaemon wrote:
Greetings, Jerry Stuckle.
In reply to Your message dated Tuesday, November 6, 2007, 08:28:20,
>AnrDaemon wrote:
>>Greetings, Jerry Stuckle.
In reply to Your message dated Monday, November 5, 2007, 17:42:13,

echo date("F",strtotime(-date('j') . ' days'));
Another piece of ***:

date('F', mktime(1, 1, 1, date('m')-1, 1, date('Y')));

;)

>Yours fails in January.

Check it before posting such silliness.

<?php

echo date('D d F, Y', mktime(1, 1, 1, 0, 1, 2007));

?>

Intended answer:
Fri 01 December, 2006

Indeed, keep being an asshole. You're good at it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Nov 6 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: eddie wang | last post by:
How to convert a month to previous month in a very easy way? For example, I have AUGUST, but I want JULY to return. Thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't...
5
by: Ray via SQLMonster.com | last post by:
Hi there, See if you can help me with the following: I need to write an SQL code that will return me: The 1st day & the Last day of the Previous Month in the following format...
1
by: Finlay | last post by:
Hi Group I am designing a report that should show a meter reading for each month and the previous meter reading for the previous month. The months are text stored in a field tMonth. The...
3
by: ryangus | last post by:
I simply wish to place the name of the last month (prior to the current month) on a report. I've tried using =Month(now())-1, which returns the numerical value as 10, but I cannot get it to...
2
by: TB | last post by:
HI, is there a formula(function) you could use to the display the previous month's name in a report. i know there is a function(formula) that returns the previous month's value (ie 4 for the...
9
by: brymcguire | last post by:
Hi, I have a requirement to design a query that identifies items sold between two dates. There is a 'SoldDate' datetime field used to register what date the item was sold. The query needs...
10
by: Massimo30 | last post by:
Looking for answers and have done a search in books and websites and still can't find the answer: I am setting up a Market Trend DB on housing figures. I have the following fields in my table: My...
0
by: marlberg | last post by:
Platform: Windows2000, WindowsXP, Windows Vista, etc Language: C#, ASP.NET Pre-compiled Libraries: Enterprise Library 3.0 full I have a requirement to implement in and display in C# and...
6
by: zandiT | last post by:
Hello i have a query with two date fields General.Date and Finance.Date. i would like the date in Finance.Date to be previous month of General.Date. So for example if General Date is in the month...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.