[darcs-users] Re: File name too long

Peter Simons simons at cryp.to
Tue Oct 14 13:32:32 UTC 2003


David Roundy writes:

 > The only catch with this idea is that currently I have no code to convert
 > the date into an ISO date.  

import System.Time

getIsoDateTime          :: IO String
getIsoDateTime           = do ct <- getClockTime >>= return . toUTCTime
                              return $ concat [ show $ ctYear ct
                                              , twoDigit . show . (+1) . fromEnum $ ctMonth ct
                                              , twoDigit . show $ ctDay ct
                                              , twoDigit . show $ ctHour ct
                                              , twoDigit . show $ ctMin ct
                                              , twoDigit . show $ ctSec ct
                                              ]
    where
    twoDigit []          = undefined
    twoDigit x@(_:[])    = '0' : x
    twoDigit x@(_:_:[])  = x
    twoDigit _           = undefined





More information about the darcs-users mailing list