ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to only have one of two HTML FORM options available in an HTML page according to UTC time (not visitor's local time)?
What I am trying to solve is that one of these two options should only be available to visitors on a particular day of the month in UTC time while the other option should be always available. This seems to be more a server-side issue but I can't figure how to start - css or Bash CGI or Javascript or whatever (I have not used PHP for more than ten years).
Alternatively, making the form available for a particular day of the month local (visitor's) time could be tested as a last resort.
Have the server serve up a different form depending the date or time.
Also, keep in mind that "the visitor's local time" and "the server's UTC time" are the same time, just in different units. If you know one, you know the other.
Displaying a form option based upon UTC should be fairly easy regardless of scripting language i.e PHP, bash or whatever. PHP has lots of ways to compare dates and a google search should find lots of information.
Server-side has no knowledge of a clients local time.
Code:
<form ...>
...
<?php
#get date
#add special form option using checkbox as an example.
if ( $today=="some date" )
print("<input type=checkbox name=\"special checkbox\" value=\"1\">");
?>
...
</form>
Is it possible to only have one of two HTML FORM options available in an HTML page according to UTC time (not visitor's local time)?
What I am trying to solve is that one of these two options should only be available to visitors on a particular day of the month in UTC time while the other option should be always available. This seems to be more a server-side issue but I can't figure how to start - css or Bash CGI or Javascript or whatever (I have not used PHP for more than ten years).
Alternatively, making the form available for a particular day of the month local (visitor's) time could be tested as a last resort.
Thank you for your help.
I would think that could be done with any server-side script. I'd try perl, but that's my go-to tool. michaelk's php example should work. Javascript could also work, I suppose. Wrap the once-a-month option in a div tag and only display that div on the appropriate day.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.