<div class="gmail_quote">On Sat, Aug 18, 2012 at 8:27 PM, Adde Nilsson <span dir="ltr">&lt;<a href="mailto:trialcodr@gmail.com" target="_blank">trialcodr@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hi.</div><div>How do you add to or subtract from a LocalTime? </div><div>I&#39;m trying to subtract a second from a LocalTime value but the only API&#39;s I can find act only on the TimeOfDay part.</div><div><br></div>

<div>subSec :: LocalTime -&gt; LocalTime</div><div>subSec (LocalTime d t) = LocalTime d $ timeToTimeOfDay ((timeOfDayToTime t) - (secondsToDiffTime 1))</div><div><br></div><div>I&#39;m obviously on the wrong track as this looks way too complex for what it&#39;s trying to achieve.</div>

<div>Calling with &#39;2012-08-18 00:00:00&#39; gives &#39;<a href="tel:2012-08-18%20-01" value="+12012081801" target="_blank">2012-08-18 -01</a>:59:59&#39; which isn&#39;t very helpful. How do I get to &#39;2012-08-17 23:59:59&#39;?</div>
</blockquote><div><br>The time-lens [1] package should do what you need.<br><br>[1]: <a href="http://hackage.haskell.org/package/time-lens">http://hackage.haskell.org/package/time-lens</a><br><br>Roman<br></div></div>