Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Script help !!

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script help !!

    Hi everyone,

    I got this bit in my script which is suppose to determine what the time of day is and set a variable to a certain message. The script is suppose to do the following:
    1. If the time is between 12am and 12pm the message should be 'Good Morning'
    2. If the time is between 12pm and 5pm the message should be 'Good Afternoon'
    3. If the time is between 5pm and midnight the message should be 'Good Evening'

    Except I can't seem to get it working like this, can you take a look at this piece of script and see why it isn't working 100%

    Thanks in advance

    if (now.getHours() > 0) {
    Mes = "Good Morning"
    }
    else if (now.getHours < 12) {
    Mes = "Good Morning"
    }
    else if (now.getHours() < 17) {
    Mes = "Good Afternoon"
    }
    else if (now.getHours() < 24) {
    Mes ="Good Evening"
    }

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Delaware, USA
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if ((now.getHours()) > 0 && (now.getHours() < 12)) {
    Mes = "Good Morning"
    } else if ((now.getHours() >=12) && (now.getHours() < 17)) {
    Mes = "Good Afternoon"
    } else if (now.getHours() >= 17) {
    Mes ="Good Evening"
    }

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks tamienne

    Thanks very much !!! Works perfectly !!!



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •