Jump to content

Search the Community

Showing results for tags 'date/time'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 3 results

  1. Formatting dates seem to be not working in the examples of W3 schools. Any ideas why? https://www.w3schools.com/js/js_date_formats var d = new Date("2015-03-25"); results in: Wed Mar 25 2015 01:00:00 GMT+0100 (Central European Standard Time)
  2. Hi there, I am new to Javascript, and finding displaying date and time confusing. I am using new Date().toLocaleString() ...which is perfect, however I am trying to remove seconds on the end as these are not relevant. How do I achieve this? Thanks
  3. Greetings, I am really new at coding php. I have been working for a while and doing some Google searches. I am trying to make a registeration page for something I am working on. I can get everything in the database but dates & times. Right now it's all bogus information. I am curious on how to take a date (like a birthday) and write it to my MySql datebase? Every attempt I have made that is the only piece that doesn't get written. Also I am having an issue with the php date getting into the database. Html code <!DOCTYPE HTML><html><head><title>Demo Game</title></head><body><h1>Test page</h1><p>This is a demo page. More to come.</p><p>In the area below. You will find a location for registration. Please attempt to make an account.</p> <!-- Divide for form formatting --> <div id="container" style="width:250px"><!-- Form for registering new users into the game. --><form id="register" action="reg.php" method="post"> <fieldset> <legend>Registration</legend> <div id="col1" style="width:75px; float:left;"> Username:<br> Password:<br> First name:<br> Last name:<br> Birthday:<br> Email: </div> <div id="input" style="width:100px; float:left;"> <input type"text" name="username" placeholder="Username" required autofocus><br> <input type="password" name="password" placeholder="Password" required><br> <input type"text" name="fname" placeholder="First Name" required><br> <input type"text" name="lname" placeholder="Last Name" required><br> <input type="date" name="bday" placeholder="(MM/DD/YYYY)" required><br> <input type="email" name="email" placeholder="Email address" required> </div> <div id="gender" style="text-align:center; clear:both;"> Gender: <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select><br><br> </div> <input type="submit" value="Register"> </fieldset></form></div> </body></html> php code <?php// Variables//$Date = now();$User = "";$Password = "";$Database = "testgame";$Table = "players";$Host = "localhost";$sqlDate = date('Y-m-d H:i:s'); //Check to make sure variables are set from index.htmif(isset($_POST[username]) && isset($_POST[password]) && isset($_POST[fname]) && isset($_POST[lname])&& isset($_POST[bday]) && isset($_POST[email]) && isset($_POST[gender])){// Connect to the servermysql_connect($Host, $User, $Password) or die (mysql_error()); //Check connectivitymysql_select_db($Database) or die(mysql_error()); // Insert data into DB$insert = "INSERT INTO $Table (username, password, name, last, email, birthday, registered, gender) VALUES('$_POST[username]', '$_POST[password]', '$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[bday]', '$sqlDate', '$_POST[gender]')"; //Check to see if the name exists (no duplicates)$result = mysql_query("SELECT * FROM $Table Where email = '$_POST[email]'"); echo $_POST[email]; if($result){ if(!mysql_query($insert)) { die (mysql_error()); echo "Record added. "; }}else { echo "Email already used."; } mysql_close($con); } //End of check ?>
×
×
  • Create New...