LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-28-2003, 09:51 AM   #1
Satriani
Member
 
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418

Rep: Reputation: 30
php and mySQL dates before a sudden year go wrong???


Hi all,

I use php and mySQL for my website. I just found out that sometimes a date goes weeeeeeee....

I have a "birthday"field in my table, which i retrieve from my php script, and put it in a var, let say $BIRTHDAY.

Since the format of mySQL dates are not what I like, I change the format to another like this:

$formatted = strftime("%d %B",strtotime($BIRTHDAY));

As you see, I only want the day and month. This seemed to work fine, until i found that one date does't show up... It was a birthday from someone born in 1966 ... When i changed it to i.e. 1980 it worked fine.

Is this some kind of "bug"in the function strtotime() or strftime(), or even mySQL? However, in the database, i see the date is correct... (Years before the year 19XX are not recognized?)

Anyone please?

Last edited by Satriani; 04-29-2003 at 02:33 AM.
 
Old 04-29-2003, 02:36 AM   #2
Satriani
Member
 
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418

Original Poster
Rep: Reputation: 30
Guys,

I really am stuck here.... It doesn't work as i expect it??
 
Old 04-29-2003, 03:13 AM   #3
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Unix epoch seconds start on January 1st 1970 so any dates before this that you try to represent using epoch seconds will fail. You'll need to consider storing the dates in a another format.

cheers

Jamie...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dumping mysql db script with dates markehb Linux - Software 2 04-23-2006 10:11 PM
Loop that will generate dates from now to beginning of year mrobertson Programming 1 10-06-2005 09:02 AM
Dates are wrong in monitoring for SUSE SyrEagle Linux - General 3 11-30-2004 08:58 AM
wrong ouputs with php and mysql!! ulto Programming 5 04-28-2004 04:52 PM
Dates and Times in MySQL oulevon General 2 09-13-2001 03:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration