Skip to content

Instantly share code, notes, and snippets.

@jamessdixon
Created December 22, 2016 00:46
Show Gist options
  • Save jamessdixon/00340d6a7e55139808051b8270276f68 to your computer and use it in GitHub Desktop.
Save jamessdixon/00340d6a7e55139808051b8270276f68 to your computer and use it in GitHub Desktop.
New Day Of Year Based On A 10 Month Calendar
open System
let getNewDate dayOfYear =
["Jan";"Feb";"Mar";"Apr";"May";"Jun";"Sep";"Oct";"Nov";"Dec"]
|> Seq.mapi(fun i m -> if i%2=0 then m, [1..36] else m, [1..37])
|> Seq.map(fun (m,ad) -> ad |> Seq.map(fun d -> m,d))
|> Seq.collect(fun a -> a)
|> Seq.mapi(fun i d -> i, d )
|> Seq.tryFind(fun (i,d) -> i = dayOfYear)
let dateOfInterest = new DateTime(2017,7,4)
let newDate = getNewDate dateOfInterest.DayOfYear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment