Jump to content

Search the Community

Showing results for tags 'date'.



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 18 results

  1. Hi – I’m having a lot of trouble with a where clause with a date in my sql query. It seems I have tried everything and read many articles & blogs, but I can’t get it working. I understand the data type is very important to match up and the format also. Anyway I’ll tell you what I’ve got and see if anyone can help me. I’m joining 3 tables in my query – everything works fine and I get the results I want UNTIL I add the where clause. Unless there is something I need to change because of the where clause, I shouldn’t need advice on that. Tables Fields Kiosks – kioskID, workDate, locationID, workerID, bills, coins - workDate is type Date Locations - locationID, storeName, branchName, locationAbbrev Workers - workerID, firstName, lastName, phoneNum $sql = "SELECT Kiosks.kioskID, Kiosks.workDate, Locations.locationAbbrev, CONCAT(Workers.firstName, ' ', Workers.lastName) AS workerName, Kiosks.bills + Kiosks.coins AS amount FROM Locations INNER JOIN Kiosks ON Locations.locationID = Kiosks.locationID INNER JOIN Workers ON Kiosks.workerID = Workers.workerID”; This part works fine and I get a long list showing the Date, Location, Worker, and Amount using PHP. BUT,(everybody’s got a big BUTT) when I tack on the Where clause – kapoof!! When I try different formats I get either 0 results or unable to process messages. Here are a couple of things I’ve tried – hopefully someone can spot the error in my ways. Thanks $sql = "SELECT Kiosks.kioskID, Kiosks.workDate, Locations.locationAbbrev, CONCAT(Workers.firstName, ' ', Workers.lastName) AS workerName, Kiosks.bills + Kiosks.coins AS amount FROM Locations INNER JOIN Kiosks ON Locations.locationID = Kiosks.locationID INNER JOIN Workers ON Kiosks.workerID = Workers.workerID WHERE Kiosks.workDate = '2017-12-05'"; Also tried without quotes like = 2017-12-05 $sql = "SELECT Kiosks.kioskID, Kiosks.workDate, Locations.locationAbbrev, CONCAT(Workers.firstName, ' ', Workers.lastName) AS workerName, Kiosks.bills + Kiosks.coins AS amount FROM Locations INNER JOIN Kiosks ON Locations.locationID = Kiosks.locationID INNER JOIN Workers ON Kiosks.workerID = Workers.workerID WHERE year(Kiosks.workDate) = 2017 AND month(Kiosks.workDate) = 12 AND day(Kiosks.workDate) = 5";
  2. Hi, i'm reading back and forward but not really coming t a solution. I would like to grab the content of an input field (not inside a form) i am using for date, but just as string. the needed output format is always DD/MM/YYYY so said : 12.02.16 or 2016 12.2.16 or 2016 12-02-16 and so on should all result in 12/02/2016 if there would be a timestamp behind it just needs to be cutted off. I really thought this would be easier :-) But it isn't Maybe somebody could point out a good article or solution for me. Thx. I'm really struggling with the regular expressions :-) var txt='31-12/2016'; var re1='(\\d)'; // Any Single Digit 1 var re2='(\\d)'; // Any Single Digit 2 var re3='(.)'; // Any Single Character 3 var re4='(\\d)'; // Any Single Digit 1 var re5='(\\d)'; // Any Single Digit 2 var re6='(.)'; // Any Single Character 4 var re7='((??:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d])'; // Year 1 var p = new RegExp(re1+re2+re3+re4+re5+re6+re7,["i"]); var m = p.exec(txt); if (m !== null) { var c1=m[1]; var c2=m[2]; var c3="/"; var d1=m[4]; var d2=m[5]; var c4="/"; var year1=m[7]; alert(c1+c2+c3+d1+d2+c4+year1+"\n"); } else { alert("Please check format"); }
  3. Hi, I was looking for a topic related to customizing an input type="date" to only select days from weeks, but I could not find something related to it. Could you please help me with this one ? Thanks. PD: I did this with JS, but I don't know if it is possible to set it directly in the input tag.
  4. jbmanz

    Math problem by date

    I want to be able to use the current date to solve a math problem, specifically as follows:If today is March 17, the math problem of the day should be:(Month times Day of Month) + 99 = Answer of the Day(3 x 17) + 99 = 150How can I create a java script to find the current month and the current day of month, multiple those two together, then add 99 and display the answer as a result. Ideally I'd like to embed this into an existing simple html page by referencing the JavaScript "math problem" so when "index.html" is opened, I have a line that shows immediately: "The answer of the day is: X" (or 150 today, etc). Thank you -- JB
  5. Hello, I want find difference between 2 dates in days in xslt1.0. I didn't find any in built function anywhere. Does anyone have idea on this? Please help me I am new in xslt. Thanks in Advanced. regards, Nitin
  6. nhuyvan1106

    setInterval() behaves strangely

    <!DOCTYPE hmtl><html lang = "en-US"> <head> <meta charset = "UTF-8"> <script type = "text/javascript"> window.onload = myFunction; var i = 11; function myFunction() { document.getElementById("output").innerHTML = display(); setTimeout(myFunction, 1000); } function display() { i--; var prompting; if (i == 0) { i = 10; prompting = confirm("Do you want to go?"); if (prompting == true) { window.location = "http://www.google.com"; } } return "You will be re-directed in " + i; } </script> </head> <body> <div id = "output"></div> </body></html> Hi guys, I just made this little countdown clock, but one thing is really confusing me, the setTimeout() function up there, it works fine, but whenever I replace it with setInterval(), the variable i doesn't step down by every 1 unit at all, instead, it goes like, 9 ....7....3, but when I use setTimeout(), it goes 10..9..8.. till 0. You guys know why? Thank you very much.
  7. funbinod

    future date with relation to mysql date

    i came to learn that future and past dates are calculated with the simple use of "strtotime()". but this is calculated in relating with current date. i want to know if a future date can be calculated in relation with database stored date? for example, if '2014-01-01' is stored in database, how can i get the date of 30 days(i.e.-2014-01-30) ahead from this date?
  8. Is there anyone that write me a javascript code that will display a certain message based on what time of day it is and what day of the week it is. I run a radio stations website and they want to put up a schedule of their on-air staff and shows on their website.Here is a code i found that worked, but it's just time in general, not what day of the week. Also, how can I make it to get the time in a certain time zone? No message at the present timefunction show() {var nowhrs = new Date().getHours();var nowmins = new Date().getMinutes();var hrsmins = nowhrs + (nowmins/60); // decimals of an hourvar schedule = [['Message 1',[9],[18]], // times are expressed as hours + decimals of an hour, e.g. 30 minutes is .5 hours.['Message 2',[18],[21.5]],['Message 3',[19.5],[20.25]]]var themessage = "";for (var i =0; i = schedule[i][1]) && (hrsmins < schedule[i][2])) {themessage += schedule[i][0] + "";document.getElementById("mymessage").innerHTML = themessage;}}}
  9. fikiwan

    display datetime from DB

    Hey ... I want display datetime from DB... EX : 2013-06-10 12:10:5 I want display only year = 2013 MONT = 06 day = 10 how to do like above display the part from datetime. thanks regards
  10. 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 ?>
  11. picokojama

    Translating date

    Hi! I have one issue with date translating. Here is my code: <?php $day = date("l"); $daynum = date("j"); $month = date("M"); $year = date("Y"); if($day == "Monday"){ $day = "Ponedjeljak"; }elseif($day == "Tuesday"){ $day = "Utorak"; } /* etc, translating day */ if($month == "January"){ $month = "siječnja"; }elseif($month == "February"){ $month = "veljače"; } /* etc, translating month */ elseif($month == "December"){ $month = "prosinca"; } echo $day . ", " . $daynum . ". " . $month . " " . $year . "."; ?> Now, problem is: Why output is "Utorak, 11. Dec 2012." (there should be "Utorak, 11. prosinca 2012.")? It translated only day, but not month, although code for month is similar to code for day.
  12. Nuker_Viper

    Date problem

    i don't quite understand why it displays this: here is the basic code... <?php$TZ = getTZInfo("tz", getMemberInfo("timezone", $membername));$T = getTZInfo("tz_plusminus_hours", getMemberInfo("timezone", $membername));$DST = getMemberInfo("timezone_dst", $membername); if($DST == "On") { $D = "1"; }else { $D = "0"; } $TF = ($T+$D); if($logged_in == "1") { $displaydate = gmdate("l, F j, Y - g:i A - $TZ", time()+(("$TF"+date("I"))*3600)); }elseif($logged_in != "1") { $displaydate = gmdate("l, F j, Y - g:i A - e", time()+((-5+date("I"))*3600)); } ?>
  13. Nedeku

    Change time constraints

    this is a personal side project of mine, i am trying to change the time constraints of the hours, minutes, seconds, as well as change the start of the year to whatever I want it to be. ie days are 35 hours long, hours are 92 minutes long, minutes are 16 seconds long, and seconds are 200 milliseconds long, and the start of the year is February 29th is the beginning of the year in corralation to today's date, and have all of this done in the 24 hour time format where when the program first loads it works i would like to have this done in JavaScript, can someone help me??
  14. aditya.2ky

    xml schema change date format

    In the xml schema data type --> date allows date as yyyy-mm-dd format by default.How can we modify it so that it accepts yyyy/mm/dd format style instead ?
  15. honkmaster

    Retrieving unix date and formatting

    Hi I have a column in my database which is called "lastupdated" it stores a unix date and time stamp '1331299541' Fri, 09 Mar 2012 13:25:41 GMT. I want to run a query to retrieve any activity that happens that day. $query = "SELECT * FROM contacts WHERE lastupdated = '1331299541'"; As you can see i'm quite new to this so looking to be pointed in the right direction. I know its to do with formatting the date stamp? Cheers Chris
  16. jleich

    Date conversion

    binding some data to a componentart datagrid. the date comes in as yymmdd (120312) and for display I do a string format "MM/dd/yyyy". If a user has selected an item in the grid I use a javascript function to loop through the items and build an xml string to update some database records. When getting to the date column it shows Mon Mar 12 00:00:00 CST 2012. Want to reformat that to MM/dd/yyyy before sending off to database. Help??
  17. baijiazi

    Html 5 Date Input

    Hi All, How do we grab the day, mth and year values from the date input with html5? Thanks
  18. morrisjohnny

    Php 2 Dates Strip Outside Business Hours

    Hello All.I'm currently working on a custom reporting function.What i'm looking todo is extract the total time elapsed ($start) for each ticket during business hours the business hours are:mon-fri: 8:30-17:30 So if a ticket was loggedMonday 8:00 and closed: Monday 9 it's 0.5 (half an hour because the SLA/Business hour states from 8:30)Monday 13:00 and closed: Tuesday 12:00 it's 9 (Because 23hours (actual time between create_time and date_completed) - 14(number of hours the SLA/Business hours does not run for = ))Friday 17:00 and closed: Monday 09:00 its 1 (again because our buiness hour stops on friday at 17:30 and re-starts from monday 08:30. Note some tickets are logged outside of business hours and some tickets may be closed outside business hours.If they are opened they need to be taken from when the business re-opens (as you'd expect)If they are closed they need to be taken from when the business closed. I'm currently calling a function called strip_out_of_ours($start,$end){ $start_month=date_format($start,'m'); $end_month=date_format($start,'m'); if(date_format($start,'H')>'17'&&date_format($start,'i')>'30')// if this has been logged after 17:30 but before midnight assign the date for tomorrow at 8:30 $start=date('y-m-d H:i:s',strtotime("+1 day",strtotime(date_format($start,'y-m-d').' 08:30:00'))); if(date_format($start,'H')<'08'&&date_format($start,'i')<'30')// if this has been logged before8:30 make it 8:30 $start=date('y-m-d H:i:s',strtotime(date_format($start,'y-m-d').' 08:30:00')); if(date_format($end,'H')>'17'&&date_format($end,'i')>'30') $end=date('y-m-d H:i:s',strtotime(date_format($end,'y-m-d').' 08:30:00')); if(date_format($start,'H')<'08'&&date_format($start,'i')<'30') $end=date('y-m-d H:i:s',strtotime("-1 day",strtotime(date_format($end,'y-m-d').' 08:30:00'))); return var_dump($start); }
×