if I code
$birth = strtotime('1 April 1950');
then $birth = -1, I guess that this is because time "began" on 1st Jan,
1970. (although I seem to remember a few good times before that).
So, what's the easiest way to find out how many days old I am (exactly,
please, not just taking 1 April 1970 and adding 20 *365, which does not
account for leap years?)
Thanks in advance. 2 2989
Baron Samedi schrieb:
if I code
$birth = strtotime('1 April 1950');
then $birth = -1, I guess that this is because time "began" on 1st Jan,
1970. (although I seem to remember a few good times before that).
So, what's the easiest way to find out how many days old I am (exactly,
please, not just taking 1 April 1970 and adding 20 *365, which does not
account for leap years?)
Thanks in advance.
Have a look at the safestrtotime() function suggested in the user
contributed notes in the PHP manual: http://ch2.php.net/manual/de/functio...time.php#54564
HTH
Markus
Markus Ernst wrote:
Baron Samedi schrieb:
if I code
$birth = strtotime('1 April 1950');
then $birth = -1, I guess that this is because time "began" on 1st Jan,
1970. (although I seem to remember a few good times before that).
So, what's the easiest way to find out how many days old I am (exactly,
please, not just taking 1 April 1970 and adding 20 *365, which does not
account for leap years?)
Thanks in advance.
Have a look at the safestrtotime() function suggested in the user
contributed notes in the PHP manual: http://ch2.php.net/manual/de/functio...time.php#54564
Thanks, that wokred a treat! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pjotr Wedersteers |
last post by:
I'm using strtotime to get the timestamp for midnight. I have a statistics
script for my pagecounter that displays hits since midnight.
I also display the number of hours and minutes passed since midnight.
$start = strtotime ('today 00:00');
$timepassed = date ('H:i', time () - $start);
The weird part is at 11.30 AM it says 12 hrs and 30 minutes have passed.
I tried adding GMT+1 like so: $start = strtotime ('today 00:00 GMT+1');...
|
by: peabody |
last post by:
I'm trying to use the strtotime() function to manage sessions. But I
get the following
<?php
print(time() . " - " . strtotime("+1 hour"));
?>
outputs:
1097380666 - 1097308800
|
by: Leif K-Brooks |
last post by:
PHP has a very nice strtotime function (http://php.net/strtotime) which
converts a date/time in virtually any format into a timestamp. Does
Python have a similar function?
|
by: Rithish |
last post by:
Hello. I noticed a strange thing while using strtotime() and date()
functions in combination to generate from MySQL into a readable format.
By default, the MySQL date field will be 0000-00-00 00:00:00 When I
pass this to strtotime() to generate the timestamp, and then pass it to
the date function, it generates 30-11-1999.
<?
print ( "<br> strtotime for '0000-00-00 00:00:00' : " . strtotime (
|
by: windandwaves |
last post by:
Hi Folk
I love the strtotime function, because I can make a date field in a form and
just tell my users to enter whatever they want and as long as it is a date,
it will work.
HOWEVER, this obviously does not work for the day/month vs month/day
scenario. That is, in New Zealand we use day/month/year, while the function
assumes it to be month/day/year.
| |
by: Brian Kendig |
last post by:
I'm working with dates in several formats including 'yyyy MMM dd', but
strtotime doesn't recognize this format and returns FALSE.
Is there a direct way to convert times from this format into
timestamps, other than my having to whip up a simple parsing routine?
My headache is that I use strtotime in a lot of places in a lot of
files, and I'd hate to have to add a wrapper everyplace I use it. I
wish there were a way to extend strtotime's...
|
by: Chris |
last post by:
I am trying to output Monday of the current week i.e. if Monday is the
8th I want to display 'Monday 8th' for any date between Monday 8-14th.
I would appreciate any help, the code below is heading in the right
direction but doesn't quite give me the results I am looking for.
$givenday = mktime(0,0,0,10,08,2007);
$Monday = strtotime("Monday this week",$givenday);
echo date("j M Y H:i:s", $Monday);
|
by: Anthony Smith |
last post by:
So, after doing some research I finally figured that php chokes on
dates past year 2525. In this web service that I use they often use
2525-05-31 as the expiration date. I want to determine how I can
convert this in a format to compare it with other dates.
Before I was trying this:
if (strtotime($territory->expirationDate) < strtotime("2008-01-01")){
/do something
}
|
by: Erwin Moller |
last post by:
Hi group,
I have been using strtotime a lot in my code.
I wonder if I made a mistake in my thinking. :-/
Here follows a stripped down example.
consider some dates:
$date1 = "2008-02-23";
$date2 = "2008-02-23";
(They are the same)
|
by: dlite922 |
last post by:
I'm not sure if it's a bug or maybe some weird way strtotime() works, but I need dates for
1. Second Sunday of March
2. First Sunday of November
for any given year (mostly current year).
This
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |