473,382 Members | 1,390 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,382 software developers and data experts.

Date function

I've asked this question last week, Thanks for your answers, but I still
having the ambiguity.
I need to have a date using today's date and a number of days:
dateX = todays date - x number of days

can someone give me an example of php code . thanks.

I'm using windows, appache server.
Jul 17 '05 #1
3 2416
I noticed that Message-ID: <sE*******************@news20.bellglobal.com>
from toufik toufik contained the following:
I've asked this question last week, Thanks for your answers, but I still
having the ambiguity.
I need to have a date using today's date and a number of days:
dateX = todays date - x number of days

can someone give me an example of php code . thanks.


print date("F jS, Y", strtotime("-x days"));
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2

On 1-Mar-2004, "toufik toufik" <to*****@sympatico.ca> wrote:
I've asked this question last week, Thanks for your answers, but I still
having the ambiguity.
I need to have a date using today's date and a number of days:
dateX = todays date - x number of days


$x = 3;

$dateX = date('Y-m-d',strtotime("- $x day")); // assuming you want the date
in a string format

$dateX = strtotime("- $x day"); // if you want the date as a unix timestamp

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #3
It works, thanks
"Tom Thackrey" <us***********@nospam.com> wrote in message
news:0d*******************@newssvr25.news.prodigy. com...

On 1-Mar-2004, "toufik toufik" <to*****@sympatico.ca> wrote:
I've asked this question last week, Thanks for your answers, but I still
having the ambiguity.
I need to have a date using today's date and a number of days:
dateX = todays date - x number of days
$x = 3;

$dateX = date('Y-m-d',strtotime("- $x day")); // assuming you want the

date in a string format

$dateX = strtotime("- $x day"); // if you want the date as a unix timestamp
--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)

Jul 17 '05 #4

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

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
8
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
1
by: Liz Malcolm | last post by:
Hello and TIA. I have a DE form with an option group that if daily is selected todays date is used for start and end date, if weekly is selected Monday - Friday is used. I am trying to add a...
10
by: John Morgan | last post by:
Does anyone know what parameter should be used instead of Date = 0 for the optional parameter in the following function? Public Function dhAge(ByVal dtmBD As Date, Optional ByVal dtmDate As Date...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
3
by: dave | last post by:
I need to compute an expiration date based on the number of hours, days, or months purchased. The expiration date needs to be expressed in minutes something like '1260481600'. How can I get the...
10
by: Jes | last post by:
Dear all I have a date field on a HTML form where the user is asked to key in dd/mm/yyyy However, when that is written to MySql it is either not accepted or another value is tored in the...
3
by: murch.alexander | last post by:
I made a simple public function to set and return a date value (see below). I have a number of queries that call up the function to get the "As Of Date," which is typically set to today's date....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.