Created
December 22, 2016 00:46
-
-
Save jamessdixon/00340d6a7e55139808051b8270276f68 to your computer and use it in GitHub Desktop.
New Day Of Year Based On A 10 Month Calendar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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