]> gitweb.factorcode.org Git - factor.git/commitdiff
add timestamp>mdtm to calendar.format
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 17 Feb 2009 23:09:27 +0000 (17:09 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 17 Feb 2009 23:09:27 +0000 (17:09 -0600)
basis/calendar/format/format-tests.factor
basis/calendar/format/format.factor

index 81930cdf49fa1963a702d74abe5d531b68316ba4..f8864351a44dfe54c951dcb87ceda875192201ac 100644 (file)
@@ -51,6 +51,11 @@ IN: calendar.format.tests
     timestamp>string\r
 ] unit-test\r
 \r
+[ "20080504070000" ] [\r
+    "Sun May 04 07:00:00 2008 GMT" cookie-string>timestamp\r
+    timestamp>mdtm\r
+] unit-test\r
+\r
 [\r
     T{ timestamp f\r
         2008\r
@@ -74,3 +79,5 @@ IN: calendar.format.tests
         { gmt-offset T{ duration f 0 0 0 0 0 0 } }\r
     }\r
 ] [ "Thursday, 02-Oct-2008 23:59:59 GMT" cookie-string>timestamp ] unit-test\r
+\r
+\r
index 15a4cb826646a6eb9b720349cce1593e23fe68cd..916d3499fe61286a7e0055003c0d11574194d87b 100644 (file)
@@ -78,6 +78,9 @@ M: integer year. ( n -- )
 M: timestamp year. ( timestamp -- )\r
     year>> year. ;\r
 \r
+: timestamp>mdtm ( timestamp -- str )\r
+    [ { YYYY MM DD hh mm ss } formatted ] with-string-writer ;\r
+\r
 : (timestamp>string) ( timestamp -- )\r
     { DAY ", " D " " MONTH " " YYYY " " hh ":" mm ":" ss } formatted ;\r
 \r