Sradesign Posted November 23, 2015 Share Posted November 23, 2015 Hi I have an strange problem with sorting of my page details using API. I use this code for getting the sorted result : <?php $notes = $pages->find("parent=/notes/,limit=20,sort=-modified"); foreach($notes as $note){ if($user->name = $note->createdUser->name){ ?> <li style="padding: 5px"> <div class="row"> <div class="col-md-8"> <div class="desc"> <span class="label label-sm bg-<?php echo $crm_color; ?>"> <i class="fa fa-<?php echo $crm_icon; ?>"></i> <?php echo $note->crm_type; ?> </span> <?php echo substr($note->crm_comment, 0, 30).' ...'; ?> </div> </div> <div class="col-md-4 text-right"> <i class="fa fa-clock-o"></i> <?php echo date("Y/m/d h:s", $note->modified); ?> </div> </div> </li> <?php } } ?> and look at the result in attachment the dates are random. Link to comment Share on other sites More sharing options...
BitPoet Posted November 23, 2015 Share Posted November 23, 2015 The problem's here: <?php echo date("Y/m/d h:s", $note->modified); ?> You're outputting seconds instead of minutes. Use "Y/m/d h:i" instead. 2 Link to comment Share on other sites More sharing options...
Sradesign Posted November 24, 2015 Author Share Posted November 24, 2015 Woooow I don't believe such a silly mistake Link to comment Share on other sites More sharing options...
tpr Posted November 24, 2015 Share Posted November 24, 2015 the dates are random. Getting random values out of a computer is not that easy 2 Link to comment Share on other sites More sharing options...
Sradesign Posted November 24, 2015 Author Share Posted November 24, 2015 you just witness that it is make a small silly mistake and you get random values Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now