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

strtotime() pre-1970 ?

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.

Sep 26 '06 #1
2 2978
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
Sep 26 '06 #2

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!

Sep 28 '06 #3

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

Similar topics

3
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...
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
5
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?
7
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...
18
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...
6
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...
5
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...
3
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...
9
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";...
1
dlite922
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). ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.