[Haskell-beginners] OI UTCTime to String
sasa bogicevic
brutallesale at gmail.com
Thu Nov 10 18:44:17 UTC 2016
Hi All,
This is a small program
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString.Lazy.Char8 as L
import Data.Time
import Network (withSocketsDo)
import Network.HTTP.Conduit
createRequestData today = [("index:brKursneListe",""),
("index:year","2016"),
("index:inputCalendar1", today),
("index:vrsta","3"),
("index:prikaz","0"),
("index:buttonShow","Prikazi")]
timeFromString s = parseTimeOrError True defaultTimeLocale "%d %b %Y %l:%M %p" s
formatDateString time = formatTime defaultTimeLocale "%m/%d/%Y" time
getDateString = getCurrentTime
getFormatedDate = formatDateString $ timeFromString getDateString
main = do
print $ getFormatedDate
And here is my error
main.hs:25:54: error:
• Couldn't match type ‘IO UTCTime’ with ‘[Char]’
Expected type: String
Actual type: IO UTCTime
• In the first argument of ‘timeFromString’, namely ‘getDateString’
In the second argument of ‘($)’, namely
‘timeFromString getDateString’
In the expression: formatDateString $ timeFromString getDateString
Thanks!
More information about the Beginners
mailing list