Welcome Guest, Not a member yet? Register   Sign In
mdate returning 12/31/1969 in date_helper.php
#5

[eluser]johnnyForums[/eluser]
[quote author="David Johansson" date="1248316620"]Are you pulling the date from the database?
could you show some code?[/quote]

In my controller:

Code:
$data['title'] = 'My New Title';
        $data['heading'] = 'My New Heading';
        $this->db->select('*');
        $this->db->from('tblProducts');
        $this->db->join('tblProductDetails', 'tblproducts.ProductID = tblProductDetails.ProductID');

        
        $this->db->where(''tblProductDetails.ProductID',$this->uri->segment(3));
        $data['query'] = $this->db->get();
        $this->load->view('product_view',$data);

And in my view, I now have:

Code:
<?php if ($row->purchaseDate !='') {echo 'purchase date ' . mdate('%m' . '/' . '%d' .  '/' . '%Y', strtotime($row->purchaseDate));}?>

I had, which prompted the initial post:

Code:
<?php echo 'purchaseDate ' . mdate('%m' . '/' . '%d' .  '/' . '%Y', $row->purchaseDate);?>

This last line would not work unless I changed date_helper to have strtotime or use it in my view.


Messages In This Thread
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:00 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:26 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:30 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 03:37 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 04:03 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 05:02 PM
mdate returning 12/31/1969 in date_helper.php - by El Forum - 07-22-2009, 09:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB