Get week day

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

PatoFrango

Active Member
Jul 12, 2017
240
14
18
Hi,

I'm having trouble trying to figure out exactly how I get the day of the week. I've learned how to get the hour and day and how to format it, but I still haven't understood how I would get the current weekday.

Code:
set {_time} to now
set {_time} to {_time} formatted as "D"
replace all "1" in {_time} with "Sunday"
replace all "2" in {_time} with "Monday"
replace all "3" in {_time} with "Tuesday"
replace all "4" in {_time} with "Wednesday"
replace all "5" in {_time} with "Thursday"
replace all "6" in {_time} with "Friday"
replace all "7" in {_time} with "Saturday"

Don't mind too much how I did it, I just based that on what how I thought the uppercase "D" meant in ISO formatting. I have no idea what I'm doing lol.
 
dont you have a time in your computer or a calender in your house or in your phone ?
 
I think you will have an error, is this for a scoreboard? If so then send me your whole Skript in a PM and I'll help.

If not then please note that the parser does not support all add-ons, check the documentation for further details.
No it doesn't print any error. «Formatted as "D"» is something that exists, it's just not the ISO format that I'm looking for. And no, it's not for a scoreboard. Thank you anyway :emoji_slight_smile:
 
No problem at all :emoji_slight_smile: But basically what I need to know is what's the format that gives me the weekday number according to ISO 8601. On Wikipedia it says that it's the uppercase "D", but that just returns me the day of the month, not of the week (in today's case it returns 3)
 
Yeah, if it's major then go to either @ShaneBee or @BaeFell they'll have the answer.
I think I'm starting to get it. I just found out that "D" can mean weekday and day of the month at the same time. It just depends what type of date we are working with. By default, the expression "now" returns something called a Calendar date, which recognizes characters like DD as the day of the month, YYYY as the year, hh as the hour in the 12 hour time convention, HH as the hour in the 24 hour convention, etc... so if I wanted to get the weekday I would need an expression to return a Week date so that I could then use the character "D" to get the number of the weekday.
https://en.wikipedia.org/wiki/ISO_8601
 
Last edited:
Status
Not open for further replies.