Time & Date Combo JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TnTourGuy
    New Member
    • Jan 2012
    • 2

    Time & Date Combo JavaScript

    I am trying to combine a JavaScript that will change a selected text based on a actual date and time of day of that date...

    Example::

    Jan. 6, 2012 @ 8:00am the text would read "Clue #1 - It's Hot & Cold"
    Jan. 6, 2012 @ 12:00pm the text would read "Clue #2 - It's Wet & Dry"
    Jan. 7, 2012 @ 1:00am the text would read "Clue #3 - It can not be eaten"
    Jan. 8, 2012 @ 4:00am the text would read "Clue #4 - It can change in just a minutes time"

    Is it possible to write a COMBO code that will do both?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Do both what? I only see one thing. Do you mean get the date and time? You can use the getTime() function which will return the number of milliseconds from midnight Jan 1, 1970.

    Comment

    • TnTourGuy
      New Member
      • Jan 2012
      • 2

      #3
      Sorry but you totally went out into left field with your answer..

      I am wanting to COMBINE 2 scripts into 1.. One that will grab the date (Jan. 01, 2012) and the Time (7:30 am) and pull information from a flat file database. to produce a result... See EXAMPLE and read it clearly...

      The Script will detect that today is Jan. 01, 2012 and it is currently 7:30am so it will write the following text (display) Good Morning You must not has stayed out too late for new years eve last night...

      THEN

      someone else visits the site at 8:30pm so the script will post (display) Good Evening, Hope your New Years Day has been a productive one...

      the flat file database will have such info as this to be displayed

      EXAMPLE

      01-01-2012 - 2:00am - Good Morning and Happy New Years to you....
      01-01-2012 - 7:30am - Good Morning You must not has stayed out too late for new years eve last night...

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        I still don't understand what the problem is. To combine two scripts, you just copy and paste one into the other.

        Comment

        Working...