Date manipulation: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: Replaced a functional call that is now deprecated)
Line 1,118: Line 1,118:
=={{header|Haskell}}==
=={{header|Haskell}}==


<lang haskell>import Data.Time.Clock.POSIX
<lang haskell>import qualified Data.Time.Clock.POSIX as P
import Data.Time.Format
import qualified Data.Time.Format as F
import System.Locale


-- UTC from EST
main :: IO ()
main = print t2
main = print t2
where
where t1 = readTime defaultTimeLocale
t1 =
"%B %e %Y %l:%M%P %Z"
F.parseTimeOrError
"March 7 2009 7:30pm EST"
True
t2 = posixSecondsToUTCTime $ 12*60*60 + utcTimeToPOSIXSeconds t1</lang>
F.defaultTimeLocale
"%B %e %Y %l:%M%P %Z"
"March 7 2009 7:30pm EST"
t2 = P.posixSecondsToUTCTime $ 12 * 60 * 60 + P.utcTimeToPOSIXSeconds t1</lang>
{{Out}}
<pre>2009-03-08 12:30:00 UTC</pre>


=={{header|HicEst}}==
=={{header|HicEst}}==