Welcome Guest, Not a member yet? Register   Sign In
dealing with codeigniter date helper
#3

[eluser]Flemming[/eluser]
this will help you get the user's time:

http://stackoverflow.com/questions/13/ho...-time-zone

Once you have that you can look at the MySQL function date_add() to calculate a date 6 months in the future.

Hope that helps you?

==========================

EDIT: scratch that ... I think this may work (please note this is totally untested!) ...

You will need to include jquery.js


In the head of your view:
Code:
< script type="text/javascript" scr="jquery.js" > </ script >

< script type="text/javascript" >

    function get_user_date()
    {
        var currentTime = new Date()
        var month = currentTime.getMonth() + 1
        var day = currentTime.getDate()
        var year = currentTime.getFullYear()
        return day + '-' + month + '-' + year;
    }

    $(document).ready(function() {

      user_date = get_user_date();

      $.post("/your_controller/store_user_time/" + user_date);

    })
    
</ script >


your controller:
Code:
function store_user_time($user_date)
  {
      $this->session->set_userdata('user_date',$user_date);
  }

the jQuery $.post calls your controller which stores the date in a CI session.

If it works you can develop it to add in the user's time as well.

Hope it helps you!


Messages In This Thread
dealing with codeigniter date helper - by El Forum - 11-25-2009, 11:54 PM
dealing with codeigniter date helper - by El Forum - 11-26-2009, 12:06 AM
dealing with codeigniter date helper - by El Forum - 11-26-2009, 08:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB