stevepatd Posted April 8, 2007 Share Posted April 8, 2007 I'm using the Date function and am getting a Warning message saying "Warning: date() expects parameter 2 to be long, string given in C:\Inetpub\wwwroot\lmc\labs\schedule.php on line 357" My code is $mon = date('M',$value); I've tried initiating this as - long $value; but it doesn't matter. How do I make this second argument a long string?? Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/ Share on other sites More sharing options...
Barand Posted April 8, 2007 Share Posted April 8, 2007 What does $value contain now? Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224427 Share on other sites More sharing options...
stevepatd Posted April 8, 2007 Author Share Posted April 8, 2007 $value is the EPOCH time. Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224446 Share on other sites More sharing options...
Barand Posted April 8, 2007 Share Posted April 8, 2007 OK, so what format? What does "echo $value" output? Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224449 Share on other sites More sharing options...
stevepatd Posted April 8, 2007 Author Share Posted April 8, 2007 1177045200 Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224451 Share on other sites More sharing options...
Barand Posted April 8, 2007 Share Posted April 8, 2007 It needs to be a longint, which it appears to be <?php $value = 1177045200; $mon = date('M',$value); echo $mon; // --> Apr ?> Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224453 Share on other sites More sharing options...
stevepatd Posted April 8, 2007 Author Share Posted April 8, 2007 So how do I turn warnings off?? Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224457 Share on other sites More sharing options...
Barand Posted April 8, 2007 Share Posted April 8, 2007 Did you echo the $value immediately before the the line giving the error? Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224489 Share on other sites More sharing options...
stevepatd Posted April 8, 2007 Author Share Posted April 8, 2007 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224504 Share on other sites More sharing options...
Barand Posted April 8, 2007 Share Posted April 8, 2007 So how do I turn warnings off?? That is a bad idea. When developing, use error_reporting(E_ALL); The code I posted gives no notices, warnings or errors, so something else is going wrong. If $value has the value you posted then it should be OK with date() function. Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224509 Share on other sites More sharing options...
stevepatd Posted April 9, 2007 Author Share Posted April 9, 2007 Ok, I'll have to play with this. Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224595 Share on other sites More sharing options...
stevepatd Posted April 9, 2007 Author Share Posted April 9, 2007 oops, I was reading the $value from a file. There was a blank line at the end of this file which I was picking up. Problem solved. Quote Link to comment https://forums.phpfreaks.com/topic/46168-solved-date-function-looking-for-long-string/#findComment-224620 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.