jwwceo Posted May 24, 2010 Share Posted May 24, 2010 Hello, I am making a website for a bond company, which has 30 year bonds. This puts the call dates at beyond 2038. None of my strtotime functions are working. Any ideas how to work around this. I think I am just storing the time as a varchar string in the DB. Can I just manually find what the strtotime value would be using sometimes like 30 times 31 556 926 seconds?? this doesnt account for leap years, etc I dont think? Any ideas?? James Link to comment https://forums.phpfreaks.com/topic/202754-year-2038-issue/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 24, 2010 Share Posted May 24, 2010 If you use your database's DATE data type and your database's date/time functions to perform operations on the values, what you are doing will work. You can also use php's DateTime class objects/methods. Link to comment https://forums.phpfreaks.com/topic/202754-year-2038-issue/#findComment-1062679 Share on other sites More sharing options...
jwwceo Posted May 25, 2010 Author Share Posted May 25, 2010 So how would I use MySQL to do this work? Would I query the DB in every iteration of the loop. I'm not sure what I would even be querying. Heres the basic structure I have in place now: $start_date = strtotime($row['int_accrual_date']); $end_date = strtotime($row['maturity_date']); while ($start_date <= $end_date){ #### DO SOME STUFF ### $start_date = strtotime('+1 month', $start_date); } Link to comment https://forums.phpfreaks.com/topic/202754-year-2038-issue/#findComment-1062806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.