how would a person go about making a calendar?

So to explain if I were to need to Say show me #1 on the calendar it says Jan, 1st and so forth but I cant see a way of doing that and was hoping to have same help.

Is this for an assignment?

No!Real programmers use unix epoches!lol

they probably dont want jokes, just answers please.

im not joking
have you ever tryed to parse a date?a (current time in milliseconds) will be better

"show #1 on the calendar" doesn't make sense, anything past febuary would depend on whether it's a leap year.

if all you need is a number to a day and month from a non-leap year, then you could either use a very long list (one item for each day) or just list each day that's a new month and go over it to find which month it is, then subtract the start of the month to get the day of the month

ok but thats not what they want

try this simple calendar i made. you enter the year (eg. 2022) and the day of the year (eg.. 295) and it gives you the date: 10/22/2022

https://snap.berkeley.edu/project?username=manyone&projectname=cal_simple

note: it has a very simple leap year logic - it simply says - if the last 2 digits of the year is divisible by 4, it is a leap year. there are more rules than that. you have to program that in. and it doesn't give you the day of week. you would have to do that too!

Here's some things to know. To determine if a year is a leap year, just do


(tip, you might be able to drag and drop the image into the snap editor to get the code, if it doesn't work, click the image first, then drag and drop it)

This works because leap years are weird. A leap year happens on a year that is divisible by 4 ( not ((year) mod (4)) ), but not on a year that is divisible by 100 ( <((year) mod (100)) > [0]> ), but if it's divisible by 400 ( not ((year) mod (400)) ), it's a leap year.

If you don't want to use this weird ruleset, then just doing calendar script pic (1) should be fine.

You do need a list of the number of days in each month in order to make a calendar, so here it is

(replace (current [year v]) with the year)

And then, the fun part. figuring out what day of the week any day is on. That's really tricky, fortunately, Wikipedia has the solution

If you just want to display a month with the all the days like in a normal calendar, you just need to get the day of the week the first day of the month is on, then when going through all the days, just change the day of the week by
calendar script pic (3)

At least that's how I would do it.

1st offsets!

Are you talking about the numbers?

yes

Oh, ok. Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.