Click here to Skip to main content
13,767,051 members
Rate this:
Please Sign up or sign in to vote.
See more:
i am a beginner with programming and I am learning F#, and I want to write code for weekdays so I want to type the date and the program should give me the day, can anyone help me with that?

What I have tried:

I do not know what to start with
Posted 8-Nov-18 14:28pm
Updated 8-Nov-18 15:06pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I do not know what to start with

Never thought about checking the documentation ?
Or ask Google ? there is only 800k results.

I let you do the search as an exercise.
Mohammad Alnajm 9-Nov-18 9:38am
module Wochentag
open Mini

let wochentag(tag: Nat, monat: Nat, jahr: Nat): string =
let q:Nat = tag
let m:Nat = monat
if m<3N then m+12N else m
if m<3N then jahr+1N else jahr
let K:Nat = jahr % 100N
let J:Nat = jahr/100N
let h:Nat = (q+((13N*(m+1N))/5N)+K+(K/4N)+(J/4N)-2N*J) % 7N
if h=0N then "Samstag"
else if h=1N then "Sonntag"
else if h=2N then "Montag"
else if h=3N then "Dienstag"
else if h=4N then "Mittwoch"
else if h=5N then "Donnerstag"
else if h=6N then "Freitag"
else "falsch gemacht"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.181114.1 | Last Updated 8 Nov 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100