[Bps-public-commit] net-lighthouse branch, master, updated. a2e5888d88674b6dc1017e782890f78f96a63c31
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Aug 31 01:14:53 EDT 2009
The branch, master has been updated
via a2e5888d88674b6dc1017e782890f78f96a63c31 (commit)
from 91e7949c8f39d197a36952368863579c92e61784 (commit)
Summary of changes:
lib/Net/Lighthouse/Util.pm | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit a2e5888d88674b6dc1017e782890f78f96a63c31
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Aug 31 13:14:41 2009 +0800
implement datetime_from_string help method
diff --git a/lib/Net/Lighthouse/Util.pm b/lib/Net/Lighthouse/Util.pm
index ecc214f..63c8a4a 100644
--- a/lib/Net/Lighthouse/Util.pm
+++ b/lib/Net/Lighthouse/Util.pm
@@ -3,6 +3,7 @@ use warnings;
package Net::Lighthouse::Util;
use XML::Simple;
+use DateTime;
sub translate_from_xml {
my $self = shift;
@@ -27,6 +28,24 @@ sub translate_from_xml {
return $ref;
}
+sub datetime_from_string {
+ my $class = shift;
+ my $string = shift;
+ if ( $string =~ /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z/ ) {
+
+ # 2009-06-01T13:00:10Z
+ return DateTime->new(
+ year => $1,
+ month => $2,
+ day => $3,
+ hour => $4,
+ minute => $5,
+ second => $6,
+ time_zone => 'UTC',
+ );
+ }
+}
+
1;
__END__
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list