[LON-CAPA-users] getting the due date for a problem

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Tue, 27 May 2008 14:51:43 -0700

Hi Bob,

> Thanks for all the information so far.  It
> appears that to get &due_date() to work at
> all you have to use it on a published 
> item.  That seems pretty obvious once 
> someone tells you about it!
> So, I a little testing with dates on a
> 2 part problem and saw the following:
> - if you set dates on the parts first and 
> don't set a date on the whole problem then 
> &due_date() returns the date for each part.  
> Nice!
> - if you set a date on the whole problem then
> that overrides the part dates as far as
> &due_date is concerned and it returns the
> due date for the whole problem even if run
> in the individual parts.

Yeah due_date should have taken a part id as an argument.

But you can use EXT to get the due data

   $due_date = &EXT("resource.$part_id.duedate");

Will return the duedate in unix time (seconds since Jan 1, 1970)

You can use localtime to make this pretty for display

   $due_date = localtime(&EXT("resource.$part_id.duedate"));

Additionaly if you are just doing this for display, there is
<displayduedate /> which is fairly well documented and can do either
overall, or specific part due dates, and can be formatted it a variety
of ways.

> - Navigate Contents always shows the correct
> dates for each part and the whole problem.
> This is a little odd but I think I can
> live with it since I want the due date
> on the last part of the problem which 
> isn't in a part so I get the date
> for the whole problem from &due_date().
> Thanks again,
> Bob Gonzales
> Binghamton University
> Chemistry Dept
> PO Box 6000
> Binghamton, NY  13902
> (607)777-2698
> FAX: (607)7774478
> rgonzal@binghamton.edu 
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

guy@albertelli.com   0-7-0-6-27,137