Unix Time Comparison
I am trying to select records within a day interval. However the comparison of the timestamp seems not to work. uniquied is timestamp. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Time Comparison - Asking The User To Select The Between Time?
I have a form thats called Conference Room Booking. In that i need to asking the user to select the between time(like 5:30 to 6:30) Everything is ok. now my problem is i shud not allow the user to select the same time. for example Another user has been requseted the time between 5:30pm to 6:30pm .Now i shud not allow the following times thats 4:30 to 5:00 5:30 to 6:00 and so on.
View Replies !
Time Comparison
i have the following condition inside an if but something is wrong because i get different output from what i expect i'm comparing a database table record fields with a user input datathe the database table record fields representing a busy slot are saved into variables as follows: Code:
View Replies !
Date Comparison For X Amount Of Time
Is there a way with the Now date to do something like: From the timestamp of "when this event happens"... dont allow this until X amount of minutes have passed from "when that event happened earlier" if you get me. So basically the users go to a "jail" and in jail they cant leave till their time is up... but im not good at cron's so trying to find a different method of working out when a time has passed...
View Replies !
Getting Time Of Day From Unix Timestamp
I'm working on my CMS, Thacmus, and I've run into one helluva snag (well, nothing big). I'm working on adding the time of day to my date field, since I've procrastinated on that, but I'm having trouble trying to get the time of day from the timestamp without it interfering with the day. I've managed to supress this with the two asterik'd Here's the code for the two fields, date, and time: Code:
View Replies !
Unix Time Format
I have around 900 dates in the format of DD-MM-YYYY and I want to convert them in Unix time format. Is there a way to do this? I was thinking of passing them into an array, and then, for each date, I would use the function date() I suppose and get the Unix time format of them. But I don't know the way to do it. So, for instance, if you have: $date_to_format=ཁ-10-2006' , how would I get the Unix timestamp?
View Replies !
Convert Unix Time
I have been using the following codes to convert time(): PHP Code: list($year, $month, $day, $hour) = explode(':', date('Y:n:d:H', time())); $now_time = mktime($hour, 0, 0, $month, $day, $year); It ouptuts 1119603600 for me to store in the database. However, now i'm having problem to convert it back to 'readable' format. For example, i want to pull out this ?' from database and show to the user according to its time like [xx:xx:xx Mth Day Year] format. How can i achieve these?
View Replies !
UNIX Time Stamp
I'm using a UNIX time stamp to work out the difference between two dates so I am left with a result in seconds. I divide that number by 60 (to get minutes) and then 60 again (to get hours) then by 24 to get days and store these numbers in variables; I then round the result using the round() function to get a whole number. What I am working on is taking the numbers and working out a query to give me results such as "This record was posted 2 days ago" or "This record was posted 10 minutes ago".
View Replies !
SQL Date/time Or Unix Timestamp?
Generally when developing applications I use unix timestamps as the method of storing dates in a sql database. However, I was wondering if I should use the standard date-time used by the database. The question then arises: continue using PHP to manipulate the dates, or allow the sql server to take over. Can anyone provide any reasons to use sql date-time rather than unix timestamps?
View Replies !
Unix(?) Time Conversion From DB Entry...
I searched this forum for an answer, and tried a few things (like the date( function, but it didn't work. This is for PHP3 (yeah, don't ask, I'm pissed about it too). I am pulling a date from a database entry that uses what looks to be a unix timestamp (1001742756 is an example). This is for a search engine I'm currently ripping apart to suit my own needs. Here's the line of code I need to insert the time into: echo " Hits In: ".$get_rows[HitsIn]." Hits Out: ".$get_rows[HitsOut]." Last Checked: ".$get_rows[last_check]." Status: ".$get_rows[checker_status]."<br>"; So what I'm trying to do here is pull from the last_check row and format it in a human-readable format.
View Replies !
Unix Time And Leap Seconds
I have Red Hat Enterprise Linux 4. I was just reading up about UTC and leap seconds. Is it true on my system that the Unix time may skip up or down by one second at midnight when there is a leap second? By "Unix time" I mean the integer returned by time() and similar functions. I'm concerned about the "down" case. Some of the software I've written assumes monotonically-increasing time.
View Replies !
Using The Unix Time Stamp In Two Columns In The Database
I am creating webpages that use PHP to talk to a MySQL database. I am using the unix time stamp in two columns in the database. One of those columns i am going to use PHP to return the original value to everytime. But, when retrieving a time stamp out of the MySQL database, I can straight print it out and the time stamp is correct. But when i try to use the date() commmand of PHP, and throw in the Unix timestamp as the optional 2nd parameter, i get say 2038 as the year when i should be getting 2001...What am i missing?...Since the timestamp runs into its "Y2K" type bugg in 2037 am i getting something related too this? Sine 01 + 2037 equals 2038?
View Replies !
Unix Time Stamp As Float Instead Of Integer?
I just noticed this when I was catching up on old posts: function getmicrotime(){ list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); $sec should be a Unix timestamp, which is an integer. What is the point of casting it to a float?
View Replies !
Text Dates To Unix Time Format
On one of my community sites, I recently switched from PHP Nuke to PostNuke. During the conversion, I noticed that PHP Nuke had a registration date format of "Mar 1, 2001" and the PostNuke has a registration date format of "983620800", so I wiped all of the users' registration dates, and they inherited the date of the new system start. I still have the old database with all the old date formats in it. Is there a way to convert "Mar, 1, 2001" into "983620800"?
View Replies !
Convert Date String To Unix Time
Basically I wrote a little script that captured the date as a string like "July 3, 2007". Well, now I'd like to take all the information recorded and put it into another database as unix time (I'm wanting to migrate my personally written scripts into a more robust pre-written forum script). I think I need to use mktime(), but I'm not sure how to convert the string date above into something useable for mktime(). Any ideas?
View Replies !
Timestamp / Unix Time Stamp Querying...
Im baffled, officially! Okay. I have a table. ORDERS --------- ID DateTime Value DateTime is generated by PHP and is a UNIX timestamp. I need to return all the orders, that were placed, say, between 4-5pm, on whatever day. I see a few functions that should help me, FROM_TIMESTAMP, HOUR, INTERVAL... but um... i just cant seem to crack how to do it... can someone just boot me in the right direction?
View Replies !
Unix Timestamp Into Textual Date Time
How do i convert a Unix timestamp into English textual date time description? In my database i have stored the date and time as 1187079740 and now i want it to be converted into 14/08/2007 13:52:20. I have currently used <?php $format = '%d/%m/%Y %H:%M:%S' $strf = strftime($format); echo "$strf "; print_r(strptime($strf, $format)); ?> I am generating data from a db to xml which gives date as <date>1187079740</date> Now my task is to convert SPECIFICALLY the value 1187079740 into it's actual textual form of 14/08/2007 13:52:20. I want the data 1187079740 to be written into a php script to generate it's textual time.
View Replies !
MySQL, Time() And Usinx Dates Unix Style
I have a field in my DB that saves the date/time as a integer. I get the time on my server using the time() function. now, moving away from php and looking at (My)SQL only. If I use functions like DATE() or NOW(), I don't get a Unix value, (but rather a formatted date). So I cannot use those functions to check against my saved value. How can I run a query that would get, say, 1 hour before the current time?
View Replies !
Convert User Entered Date And Time To Unix Timestamp Before Inserting To Database
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and three dropdow boxes for hours, minutes, and AM/PM. All of these need to be considered together and converted to one Unix Timestamp and then inserted to the MYSQL date field. The type of field is INT (11) so that I can instead of the standard 0000-00-00 format of MYSQL so that I can do better calculations and queries.
View Replies !
Comparison Problem...
What's the equivalent of perl's =~ operator in PHP? I have a variable and I need to check if somewhere in its value a certain piece of data exists.
View Replies !
3 Or More Variable Comparison
I was trying to compare the value of 3 different variables in a row but I was only able to compare two of them. What I want to do is to compare if the value of $VarOne, $VarTwo and $VarThree are all equal to "Ok" string. PHP Code:
View Replies !
Anyone Knows A Technical Comparison Of IPB And VB And UBB?
I want the best board: low CPU/memory take. Low MySQl usage. I have heard that PHPBB is the worst if you know PHP and read the codes. So I pass on that one. Can anyone who knows PHP inside out tell me the technical comparison of IPB and vB and UBB? Which one is the fastest? Which takes the least MySQL update? Which one can handle the largest BBS?
View Replies !
Database Comparison?
I've only got a couple years experience developing for Access but have recently been experimenting with HTML/javascript for gui and client-side scripting, mysql for database and php for server-side scripting. I've been running it all on the development machine until the application I'm building is advanced enough to start optimising/testing with network lag in mind. So it's no slower, and in some ways at least it seems faster. Has anyone had much experience with both? If so, what are your relative opinions of the two packages if used for the same purposes? I haven't made up my mind as to convenience overall since the web-based app hasn't been deployed to any users yet (although I can imagine that will be simpler, since people just need to connect to an ip address), but a few advantages I have noticed in developing it include: - Less confusion due to separation of components. While I thought it might make things more complicated, it seems clear after using it that php is built more than anything to easily sit on an apache server, talking to a mysql database and spitting out html to a web browser. That makes sense I guess since php is made only by its users and that's what most people seem to use it for. The actual advantage to separating the components is you know where the problem is. If you get an error in the javascript console, it's a javascript error, if it's in the browser it's php, unless it's in the database, in which case it says it's a mysql error. Given how unintuitive error-messages often are for any programming tools, knowing where to start at least, is nice. Besides debugging myself, it also makes it easier to find posts on the net from other people who have had the same problem. Which brings me to... - Developer discussions on the internet include more people with access to the source code. So bugs or problems in the tools themselves often prove less obscure, if they haven't already been fixed. I've never personally inspected the source code of any of the programming tools I use unless I've written them myself, but when you go on the net looking for fixes or workarounds, a lot of people have. This could be my psychological bias towards the ideals of open-source software, but it does seem that mysterious quirks which, even when you fix them, make no sense; are less common. - Less risk of future incompatibility. Web browsers, to take one obvious example, seem to be more compatible with things written for older versions of themselves, than microsoft access is. Sometimes the automatic upgrade of your mdb will work, but often you need to make a lot of code changes to support a newer (or older) version of access, and in the worst case it's much easier to have two web browsers running on your machine if you need, than it is to have two versions of Access. Maybe there are more advantages. As for disadvantages I thought I would miss the form designer, and in some ways I still do, but html/js/php are very versatile, and in the process of learning how to use these things better I've made a rudimentary gui designer and some templating functions, which allow fairly easy manipulation and reuse of gui components. Another fear I had was the lack of functionality, especially since html has a much smaller widget set than access forms (although I guess it's always possible to use xul instead and then distribute firefox to all the users), but that problem seems much smaller now, especially as I learn more about javascript's abilities. There are definitely some things html/js/php can do which access forms and vba can't (or not as easily), some of which seem useful, but as to what practical importance all these differences will make, that remains to be seen. Oh and also there are a lot more easily accessible examples of creative/clever ways of using this combination of tools since it's what many (most?) web developers use, so you can just look at a bunch of websites to get ideas for how to best achieve what you want.
View Replies !
Array Comparison
Lets say i have these two arrays (PHP 4.3.3) $arr_1 = array( [left] =22, [up] =4, [right] =10 ); $arr_2 = array( [bottom] =13, [up] =6, [right] =12 ); I need to get the new array which would look like this: $arr = array( [left] =22, [up] =10, [right] =22, [bottom] =13 ); the thing is that i should put two arrays into one by this rules: for same keys create one key with value of all values of that key for different keys just create their key with their value
View Replies !
Difference Between == And === Comparison
I hope some of you good people would clarify this to me. Recently I saw a bug in phpBB, which circumvented the way a user is automatically logged in. The bug is described at: http://seclists.org/lists/bugtraq/2005/Mar/0104.html Well, the solution is to change this line: if( $sessiondata['autologinid'] == $auto_login_key ) into: if( $sessiondata['autologinid'] === $auto_login_key ) and that confuses me :( Since in my programming I always use == operator, I was wondering am I at risk? What is the real difference and when should I use the === operator. I hope you'll understand what I'm asking... since I think it's way better to learn on others mistakes then on my own...
View Replies !
String Comparison
If anybody knows Google Docs. They have a revision history. And when you compare two docs they say what has been added and what has been removed. I've done something similar. But it's now working very good and i want to change the hall thing. So...can anybody tell me.. is there a library of some sort? I got something called inline_diff. But it's not very good. It does just word comparison and I don't need just word comparison, but also phrase comparison and paragraph comparison if case. That means that let's say if 50% of a phrase has changed then the hall phrase has changed. The same for the paragraph. Anybody know how to do that?
View Replies !
Comparison Script
I dont have any script to show anyone, as i have not started the build yet. Im looking to do a mobile phone price comparison for my review site Using csv files from affiliates. As this would be sorted by handset what would be the easiet way of getting the phone model to all be the same. As different scripts call the same phone different things. I know it would probably be to replace it in the csv file before uploading but i was trying to get something a bit quicker as they need to be updated every day and there are over 30 sheets.
View Replies !
Table Comparison
I'm selecting information from two MySQL tables using a UNION query. The data output will be in a list format. A snippet is as follows: $query = "select cl_id, cl_status from clients_confirm UNION select cl_id, cl_status from clients ORDER BY cl_id"; $result = @mysql_query ($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row['cl_status']'<br />';} There are some rows (purposely) that will have the same number(id) from both tables (e.g cl_id from clients_confirm & cl_id from clients). Here is a sample list output: 1 cl_status 2 cl_status 2 cl_status (don't want this second one... or maybe the first) 3 cl_status 4 cl_status etc. I need to find a way to choose only one of the id's when two of the same (one from each table) are selected. In other words, I don't want duplicate rows echo'd.
View Replies !
PHP >= Comparison Problem
I had a simple if statement that checked the values of 2 variables, and if one is greater or equal then the other, it added a value to an array. The problem is that the numbers are the same, but it's still failing. So I then converted them both to float values. Both values before were 22. When I use var_dump() they display the following: Code:
View Replies !
Database Comparison
One table called contacts and another table called user_info. Each table has a field called "email". There are 80 entries in "user_info" and 400 in "contacts". I want to take the info from user_info and check if that email address is in contacts and if it is add "Regestered" to the field "Status" in the "contacts" table otherwise I want it to add "Unregistered" Is there an easy way to do this?
View Replies !
Comparison Tool
My knowledge of PHP is limited to making slight changes to existing scripts. I now have the ambition to do a comparison tool as follows. I want to compare apples, oranges, bananas, grapes and pears. Each option would have a checkbox. When someone checks apples, oranges and bananas, they'd be taken to static page comp_aob.html, when someone checks apples and bananas, they'd be taken to comp_ab.html. Could someone help me get started? I'd like this to be as simple as possible but I have no idea where to start.
View Replies !
Binary Comparison,
I've just a short question. As im using some binary comparison in order to check which part of my homepage is visible for the user i want to compare two values against each other. I've got the following visible levels: Guest = 2 = 001 Binary Registered = 4 = 010 Binary Admin = 8 = 100 Binary. Now when i want an Element of the homepage to be visible only for Registered users and admins i will assign the value 12 (which is 110 Binary). When it comes to the visible desission i thought i can do the following operation: $visibleTo = 12; //Element should be visible to Admin and registered user $currentUserVisibleLevel = 8; //user is admin $elementIsVisible=($visibleTo & $currentUserVisibleLevel) > 0; //expected: //$elementIsVisible = 8 or at least greater then 0 //because 12 & 8 == 110 & 100 = 100 = 8 echo "result:".$elementIsVisible."!"; //prints result:! What am i doing wrong?
View Replies !
Comparison Operator
what is wrong with this? $num_Pages = 147; $max_pages_to_show = 20; if ($max_pages_to_show <= $num_pages) { print "less than"; } else { print "more than"; } I have used is_int to make sure the values are integers, yet this code consistently prints "more than". What am I doing wrong?
View Replies !
Price Comparison
I want to add a price comparison feature to website so that users can click on one of my products and compare its price to the price of other sellers on the web. Can anyone point me to a good tutorial or article about how to do this? I have no idea where to start.
View Replies !
Comparison Question
I need to be able to compare availability of people to find common availability. I'd like to have Person A, who is available from say 10:00 to 14:00, and be able to search my database for people with matching availability. Has anyone done anything similar to this? I'll admit, I don't even really know where to start. I'm trying to decide if it would be better to store availability in blocks, like having Person, Start, Finish fields in a table or if it would be better to store the times they are available, like having just Person, and Time fields in a table.
View Replies !
Object Comparison
I've got the following issue: I've menaged to parse RSS data from a given XML file into a PHP object with SimpleXML. As this is quiet a trivial task, so far so good. At a particluar spot within the code I have the following object instances. Here's a print_r($obj); Two first two object instances are equal because they have the same attributes and values, wheras the third one is different. What I like to be doing here before going any further is to get rid of duplicates and only take unequal instances to proced with my methods and code. My idea now is to compare a particular attribute (E.g. $obj->title) and if that attribute appears to exist more than once, get rid of the/all duplicate/s. Something like DISTINCT in SQL if that make sense How can I get that going? stdClass Object ( ........
View Replies !
Date Comparison
I have a date in a mysql database that was entered as a varchar field rather then a date formatted field. So the dates in the database look like so: 03/28/06 11/28/06 4/02/06 so either MM/DD/YY or M/DD/YY problem is now I need to do date in ranges from lets say 03/01/06 - 07/01/06
View Replies !
Datetime/date Comparison
I have a timestamp field in a customers table, which is set to the current date/time when a new customer is registered. I want to run daily reports listing all customers who registered that day, but I can't simply query the db (MySQL) where timestamp = 񟭀-0-521'. Do I need to check for "where timestamp >= 񟭀-05-21 00:00:00' and timestamp <= 񟭀-05-21 23:59:59"? If so, how do I convert a date to a datetime type?
View Replies !
Clever Comparison Functions
I'm thinking about a script that I need to write that has simple serch functions. What I would need is to take a string as the key word and compare it woth other strings in an array. This isn't hard. I would like to order my results with the best matches first. I can do this very basically by putting anything that exactly matches at the top and then listing other matches that have partial matches but I would like the user to be able to enter part of the string and have matches like this: User enters "ronald" Script returns (in order of closeness) 1. ronald 2. ronaldo 3. ronaldino 4. ronny 5. ron 6. rob 7. aled Not necessarilly in that order but you see what I mean (hopefully). Ideally php would have a function which compares the strings and returns a cooficient of matchingness or something but unfortunatly I can't find one of those. I have though (vaguely) about my own function to do this which would include regexp to match at certain levels however I'm really poor at regexp. I imagine something like this: PHP Code:
View Replies !
Date Comparison Calculation
I want build and extract data from a mysql table by date. The problem is that my table data needs to be by date range as follows. Example: key field is DATE field row 1: 02-19-96 to 02-06-97 row 2: 02-07-97 to 01-27-98 row 3: 01-28-98 to 02-15-99 and the input for the query will come from a FORM input (without range), example: Enter birthday input value could be 05-13-96 How can I query the table and select the row with the correct range.
View Replies !
String Of Bits Comparison
I have a string of bits 0s or 1s ,the string is 32bits but for now lets keep it simple, for example : 0100 which is stored in mysql database. Now i want to do a search for any string in which the third bit is a 1 regardless of what the other bits are, like: xx1x (x can be either 0 or 1).
View Replies !
String Comparison Problems
My website is based on some CMS sytem. From there I am getting a string value passed into php, which I would like to compare to two possible choices. The result of this comparison would be used to set a dropdown menus selected option. For some reason I cannot do this right. I think it might have something to do with foreign characters that I am using, althogh I am not 100% sure... Here is what I have. $localvar = array("{string variable from CMS}"); // this comes from the CMS and is either "kereskedő" or "magánszemély" $choices = array("kereskedő", "magánszemély"); // this is just a preset array with the two possibilities echo '<select name="yourtype">' // setting up the pulldown menu foreach ($choices as $value) { echo "<option value="" . $value . """; if ( $value === $localvar[0] ) echo " selected"; echo ">" . $value . "</options>"; } echo '</select><br />' If I echo $localvar[1] out I do get either 'kereskedő" or "magánszemély", but when it passed through the conditional, it always fails. What could be going on here?
View Replies !
PHP V Python: Fair Comparison?
- Python is more readable, and more general purpose - PHP has awful backward compatibility - PHP has a lower barrier to entry - Most inexpensive web-hosters support PHP, but not Python - PHP has far more pre-writen scripts available - mod_python is difficult to set up, and use, and is buggy and prone to crash - There is more demand for PHP developers, than Python developers
View Replies !
String Similarity Comparison
I'm looking for a method to compare two strings and grade them for similarity. My idea is to strip out common words and punctuation and create a checksum of each remaining string. I would then compare the checksums and if they are close then there's a potential match (to be judged by user interaction.)
View Replies !
Date Comparison Check
let's say you have the following strings: 7/20/02 7/20/03 and then you have this string: 8/15/02 Now let's say you need to verify that the string 8/15/02 is a valid date occuring within the date range of the first two date strings. What are some functions and practices that could be used to accomplish this?
View Replies !
|