jason213123 Posted July 3, 2010 Share Posted July 3, 2010 hi, i want convert the time stamp unix format to hours and days i have this: $date = trim(date('H:i:s', $ofwhat)); $ida = trim(date('d', $ofwhat)) -1; if ($ida >0) {if ($ida==1) { $dia= $ida. " day, "; } } if ($ida >0) { if ($ida>1) { $dia= $ida. " days, "; } } this work fine in my local pc that have php 4 if i put this: echo unix2data(3600,4); they return 1 hour that is correct but when i put in the server running php 5 the echo unix2data(3600,4); return 19 hours! what i doing wrong? thanks a lot for your help Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/ Share on other sites More sharing options...
Mchl Posted July 3, 2010 Share Posted July 3, 2010 You'd need to post entire unix2data function. Please use tags for pasting your code. Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/#findComment-1080672 Share on other sites More sharing options...
bobby317 Posted July 3, 2010 Share Posted July 3, 2010 This helped me maybe it will for you as well: http://www.richardlord.net/blog/dates-in-php-and-mysql Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/#findComment-1080674 Share on other sites More sharing options...
jason213123 Posted July 3, 2010 Author Share Posted July 3, 2010 hi, i have done this: $phpdate ="3600"; $mysqldate = date( 'd H:i:s', $phpdate ); $phpdate = strtotime( $mysqldate ); echo $mysqldate; but the problem remains the same in my pc i see 1 hour in server i see 19h... Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/#findComment-1080689 Share on other sites More sharing options...
Mchl Posted July 3, 2010 Share Posted July 3, 2010 This code doesn't make any sense... What are you trying to do? Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/#findComment-1080691 Share on other sites More sharing options...
jason213123 Posted July 3, 2010 Author Share Posted July 3, 2010 hi, i have this number: 3600 and i want convert that number into this: 0 days 1:00:00 just that Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/#findComment-1080693 Share on other sites More sharing options...
Mchl Posted July 3, 2010 Share Posted July 3, 2010 echo date('z \d\a\y\s h:i:s',3600) Link to comment https://forums.phpfreaks.com/topic/206628-convert-unix-to-day-and-hour/#findComment-1080836 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.