Hello out there in the jungle...
=)
I found out that i can calculate the dates e.g
$today = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d"),
date("Y")));
$yesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 1,
date("Y")));
$dayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"),
date("d") - 2, date("Y")));
$dayBeforeTheDayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0,
date("m"), date("d") - 2, date("Y")));
and so on........
This works even if we have the 1st of August $yesterday gives me the 31st
july.
Can I do this with times also??
e.g. Iit it now 17:06 an i want to make minus 20 min (like abopve minus 1
day) and I want the result to be 16:46.
I tried the above example, wit %H%M but it does not work?
Any ideas?
Thanks
:-X 3 1690
In article <8c**************************@posting.google.com >, georgios zakitraxis wrote: Hello out there in the jungle... =)
I found out that i can calculate the dates e.g
My favorite function: strtotime
Check it out in the manual :)
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
"georgios zakitraxis" <ef****@yahoo.de> wrote in message
news:8c**************************@posting.google.c om... Hello out there in the jungle... =)
I found out that i can calculate the dates e.g
$today = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d"), date("Y"))); $yesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"))); $dayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 2, date("Y"))); $dayBeforeTheDayBeforeYesterday = strftime('%Y%m%d',mktime(0, 0, 0, date("m"), date("d") - 2, date("Y")));
and so on........
Unix timestamps are in general easier to work with as they're just numbers:
define(SECONDS_IN_A_DAY, 60 * 60 * 24);
$now = time();
$today = date("Y m d", $now);
$yesterday = date("Y m d", $now - SECONDS_IN_A_DAY);
$dayBeforeYesterday = date("Y m d", $now - SECONDS_IN_A_DAY * 2);
$dayBeforeTheDayBeforeYesterday = date("Y m d", $now - SECONDS_IN_A_DAY *
3); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hans Gruber |
last post by:
Hi all,
I have been struggling with a problem all day, I have been unable to come
up with a working solution.
I want to write a function which takes 2 unix timestamps and calculates
the...
|
by: Havatcha |
last post by:
Does anyone know of a decent (free/easy to use) C++ library for
manipulating matrices and caculating eigenvalues, eigenvectors and so
on? I intend to add some Principal Component Analysis...
|
by: Megan |
last post by:
quick summary: i'm having problems trying to group fields in a report
in order to calculate percentages. to calculate percentages, i'm
comparing the results from my grouped fields to the totals....
|
by: Ron Vecchi |
last post by:
I need to calculate the age of a person based on a DateTime BirthDate
I was thinking
TimeSpan ts = DateTime.Now - BirthDate;
//I can get the days but not years.
// I could check each...
|
by: StormyTheCat |
last post by:
Perhaps this is easy, but I'm new to C# am in need of some help.
I need to embed a CRC value into an XML file to be able to detect when the
data contained
therin is corrupted. Calculating the...
|
by: jdcrief |
last post by:
Complier: Visual C++ 2005 Express Edition
The program I wrote will compile and execute, but the output is always
the same, no matter what number is entered in for the radius of the
circle. ...
|
by: Paul Aspinall |
last post by:
Hi
Can anyone recommend a suitable way of calculating distances between UK post
codes??
Many websites do this, and I'm wondering if there is some standard code, and
where the reference DB comes...
|
by: Umesh |
last post by:
i want to calculate the time required to execute a program. Also i
want to calcute the time remaining for the execution of the program.
how can i do that?
pl mention some good websites for...
|
by: Blaize |
last post by:
Hi,
I'm having an issue trying to calculate time. Its okay if the value does not exceed 24 hours otherwise I get a date and hours listed. For example, I have a loop which looks through a table...
|
by: Brian |
last post by:
I have a 2000/2002 Access db that I use to collect and store my exercisetime using a form to enter. I wanted to see a summary of the total timefor each exercise so I have a subform that does this....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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,...
| |