• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Joined rows in mdate() function?

I have a model where todays entries are shown for the user. However, I want the user's time-zone and daylight settings to be considered. I have tried to join these settings from the account table but I don't know how to include them in the mdate() function.

I've tried with the code below but it wont work:

function todays_posts()
        $this->db->join('accounts', 'account_id = post_account_id');

        $this->db->where('DAY(FROM_UNIXTIME(post_date))', mdate('%d', gmt_to_local(now(), 'accounts.timezone', 'accounts.daylight')));    
        return $this->db->get();

Any help are much appreciated. Thank you very much! Smile

Are you trying to use database field values in a CI helper function?
mdate('%d', gmt_to_local(now(), 'accounts.timezone', 'accounts.daylight'))
This won't work as you discovered.

What you could do is something like
The timezone and daylight variables come from the information the user provided you.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.