[system] / branches / gage_dev / webwork2 / lib / WeBWorK / Utils.pm Repository:
ViewVC logotype

Diff of /branches/gage_dev/webwork2/lib/WeBWorK/Utils.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 6648 Revision 6649
478 478
479sub parseDateTime($;$) { 479sub parseDateTime($;$) {
480 my ($string, $display_tz) = @_; 480 my ($string, $display_tz) = @_;
481 warn "time zone not defined".caller() unless defined($display_tz); 481 warn "time zone not defined".caller() unless defined($display_tz);
482 $display_tz ||= "local"; 482 $display_tz ||= "local";
483 #warn "parseDateTime('$string', '$display_tz')\n"; 483
484 484
485 # use WeBWorK 1 date parsing routine 485 # use WeBWorK 1 date parsing routine
486 my ($second, $minute, $hour, $day, $month, $year, $zone) = unformatDateAndTime($string); 486 my ($second, $minute, $hour, $day, $month, $year, $zone) = unformatDateAndTime($string);
487 my $zone_str = defined $zone ? $zone : "UNDEF"; 487 my $zone_str = defined $zone ? $zone : "UNDEF";
488 #warn "\tunformatDateAndTime: $second $minute $hour $day $month $year $zone_str\n"; 488 #warn "\tunformatDateAndTime: $second $minute $hour $day $month $year $zone_str\n";
489 489
591=cut 591=cut
592 592
593sub formatDateTime($;$) { 593sub formatDateTime($;$) {
594 my ($dateTime, $display_tz) = @_; 594 my ($dateTime, $display_tz) = @_;
595 warn "Utils::formatDateTime is not a method. ", join(" ",caller(2)) if ref($dateTime); # catch bad calls to Utils::formatDateTime 595 warn "Utils::formatDateTime is not a method. ", join(" ",caller(2)) if ref($dateTime); # catch bad calls to Utils::formatDateTime
596 warn "not defined formatDateTime('$dateTime', '$display_tz') ",join(" ",caller(2)) unless $display_tz and $dateTime; 596 warn "not defined formatDateTime('$dateTime', '$display_tz') ",join(" ",caller(2)) unless $display_tz;
597 $display_tz ||= "local"; 597 $dateTime = $dateTime ||0; # do our best to provide default values
598 $display_tz ||= "local"; # do our best to provide default vaules
598 599
599 my $dt = DateTime->from_epoch(epoch => $dateTime, time_zone => $display_tz); 600 my $dt = DateTime->from_epoch(epoch => $dateTime, time_zone => $display_tz);
600 #warn "\t\$dt = ", $dt->strftime(DATE_FORMAT), "\n"; 601 #warn "\t\$dt = ", $dt->strftime(DATE_FORMAT), "\n";
601 return $dt->strftime(DATE_FORMAT); 602 return $dt->strftime(DATE_FORMAT);
602} 603}

Legend:
Removed from v.6648  
changed lines
  Added in v.6649

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9