Jump to content
  • 0

Question

4 answers to this question

Recommended Posts

Posted

// If Monday, Wednesday, or Friday perform an action.
if(gettime(4) == 1 || gettime(4) == 3 || gettime(4) == 5)
{
  // Do Whatever
}

*gettime(<type>)

This function will return specified information about the current system time.

1 = Seconds (of a minute)
2 = Minutes (of an hour)
3 = Hour (of a day)
4 = Day of the Week (0 = Sun, 1 = Mon, 2 = Tues, 3 = Wed, 4 = Thurs, 5 = Fri, 6 = Sat)
5 = Day of the month.
6 = Number of the month.
7 = Year.
8 = Day of the year.

The example code I gave does the following:

- gettime(4) returns the current day of the week as a digit between 0 (Sun) and 6 (Sat).

- Using the if statement with || ("or"), I checked to see if the returned digit was either 1 (Mon), 3 (Wed), or 5 (Fri).

- If the returned digit was 1, 3, or 5 it will then perform the task.

Posted

// If Monday, Wednesday, or Friday perform an action.
if(gettime(4) == 1 || gettime(4) == 3 || gettime(4) == 5)
{
  // Do Whatever
}

*gettime(<type>)

This function will return specified information about the current system time.

1 = Seconds (of a minute)
2 = Minutes (of an hour)
3 = Hour (of a day)
4 = Day of the Week (0 = Sun, 1 = Mon, 2 = Tues, 3 = Wed, 4 = Thurs, 5 = Fri, 6 = Sat)
5 = Day of the month.
6 = Number of the month.
7 = Year.
8 = Day of the year.

The example code I gave does the following:

- gettime(4) returns the current day of the week as a digit between 0 (Sun) and 6 (Sat).

- Using the if statement with || ("or"), I checked to see if the returned digit was either 1 (Mon), 3 (Wed), or 5 (Fri).

- If the returned digit was 1, 3, or 5 it will then perform the task.

how if i make it 1 week have 3 days the event is open for everyone

Posted

how if i make it 1 week have 3 days the event is open for everyone

Not entirely sure what you mean... can you re-phrase the question please?

The script I posted should perform whatever code you put in it every Monday, Wednesday, & Friday on every week.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...