Jump to content

Search the Community

Showing results for tags 'timestamp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

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


Age


Donation Link

Found 13 results

  1. I use the theme as an affiliate deals aggregator. I am using WP all import plugin to import deals from xml files. On import, I face a major problem concerning the expire date as in every xml, it is in the format: “2015-04-23 00:00:00”, while your theme requires UNIX timestamp and can not convert. I used strtotime() in wp all import to convert date to timestamp in real time. But im getting this error : Warning: date() expects parameter 2 to be long, string given in /home/xxxx/xxxxx.com/wp-includes/functions.php on line 112/114/116 and 117 The functions.php file : function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { global $wp_locale; $i = $unixtimestamp; if ( false === $i ) { if ( ! $gmt ) $i = current_time( 'timestamp' ); else $i = time(); // we should not let date() interfere with our // specially computed timestamp $gmt = true; } /* * Store original value for language with untypical grammars. * See https://core.trac.wordpress.org/ticket/9396 */ $req_format = $dateformatstring; $datefunc = $gmt? 'gmdate' : 'date'; if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );-----------LINE 112 $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); $dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );------LINE 114 $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); $datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );----LINE 116 $datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i) );------LINE 117 $dateformatstring = ' '.$dateformatstring; $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring ); $dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring ); $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); }
  2. Im running a site and have a problem. Visitors can download sermons and can see when the sermon was preached. The problem is that everytime I upload a sermon I have to mannually insert the date of the file into the code. Even if I manually edit the date of the file (last modification date) on my pc. When I upload the file to the server it automatically takes on the current date. I tried the touch function and filemtime function but to no avail. The time keeps ticking and is not static. The whole idea is that I change the modification time on my pc and just upload the sermon and then on the server through code get the time the file was last modified. And that would be the date the sermon was preached.
  3. I am trying to format a normal date into a timestamp. To convert a timestamp into the normal date was no problem, but now I have an array with 4 different dates! 2 normal dates : 1991-12-09, 12.03.1984 and also 2 timestamps in one array. If I had the same format I could strpos it and make an if and test with "." that worked last time, but now I have those 4 different formats. Anyone an idea?
  4. I have users who signed up for an email list and there is a table of them and the join date is in unix timestamp. I do not care about the date, only the time they signed up. I am putting together code to be run on cron to decide who gets emailed. It will be run probably every hour. When it runs the first thing I need it to do is select all users who from the current time through the next hour registered. This way I can then email people around the time they initially joined my site. Here is what I have: //$input is the minutes range (which will be most likely an hour so this variable should be 60) function to_email($input) { require_once('dbconnect.php'); $cur_hours = date('H'); $cur_minutes = date('i'); $cur_seconds = ($cur_minutes + ($cur_hours * 60)) * 60; $end_seconds = $input * 60; $end_seconds = $cur_seconds + $end_seconds; $result = mysql_query("SELECT * FROM usertable WHERE " . $cur_seconds . " <= (HOUR(opt_time)*60*60) + (MINUTE(opt_time)*60) + SECOND(opt_time) AND '" . $end_seconds . " > (HOUR(opt_time)*60*60) + (MINUTE(opt_time)*60) + SECOND(opt_time)'"); $row = mysql_fetch_array($result); } The php part works as what I think is needed. But the query does not. I am not very good at MySQL queries so don't judge.
  5. Hello everyone! I am trying to insert a student into a table (with TIMESTAMP; works with VARCHAR, not TIMESTAMP). Can anyone help? Variable $time_stamp = date("D M j G:i:s T Y"); Populate DB Query ("DROP TABLE IF EXISTS enrolled") || !$link->query("CREATE TABLE enrolled(course_id VARCHAR(50), student_id VARCHAR(50), user_ip VARCHAR(50), time_stamp TIMESTAMP(6)) Insert Query INSERT INTO enrolled(course_id,student_id,user_ip,time_stamp) VALUES('$course','$number','$user_ip','$time_stamp')
  6. HI, I am a beginner at programing and I have to do this project where it is asking me to valid ISBN 10 and 13 using MySQL database to store the information. I checked my php code to validate ISBN 10 and 13 and it works, but when I try to store the data to MySQL it is not working. What I mean is that when I click ShowISBN link it doesn't show this information: ISBN Number ISBN Type Date Entered using timestamp Valid or Invalid This is the codes I have for input page of ISBN page: <?php //this is the isset function which allows us to submit back //to the same form. If there isn't anything in the ISBN, it will //show the bottom part of the form if(isset($_POST["ISBN"])|| empty($_POST['isbn_type']) || empty($_POST['Valid_Invalid'])) { $ISBN = $_POST["ISBN"];; $IsbnType = $_POST["isbn_type"];; $VaorIn = $_POST["Valid_Invalid"];; $ISBN_Arr = str_split($ISBN); $not10 =0; $notNum=0; $notX=0; //entering error checking for the code //check for 10 first, if clear do additional checking if(strlen($ISBN) == 10) {//start further error checking //check to make sure first 9 are numeric for($i=0;$i<=8;$i++) { if(!is_numeric($ISBN_Arr[$i])) $notNum = 1; }//end for loop check //check to see if there is a X or a x if($ISBN_Arr[9]=='x' || $ISBN_Arr[9]=='X') { $ISBN_Arr[9] = 10; } //if not an x, is it at least numeric? else if (!is_numeric($ISBN_Arr[9]) ) { $notX=1; } }//end additional error checking else { $not10=1; }//end not 10 check //start of error messages if prereqs are not met if($notNum ==1 || $notX ==1 || $not10) { Print "<h2>Input error</h2><br/>"; Print "Here is the error(s) discovered:<br/>"; if($notNum ==1) print"Your ISBN contains non-numeric data.<br/>"; if($notX ==1) print"The last digit is not a number or a X.<br/>"; if($not10 ==1) print"ISBN 10 number should contain 10 characters.<br/>"; include"ISBN_not_val_include.html"; } //end error checking else{ $chk_sum_num=10; $chk_sum =0; for($i=0;$i<=9;$i++) { $chk_sum +=$ISBN_Arr[$i] *$chk_sum_num; //print"$ISBN_Arr[$i] | $chk_sum_num<br/>"; $chk_sum_num--; }//end for loop $is_valid_ISBN= $chk_sum%11; //print"chk_sum: $chk_sum </br> is_valid_ISBN: $is_valid_ISBN</br>"; if($is_valid_ISBN==0) { print"<h3>VALID</h3><br/>"; print"$ISBN is a VALID 10 digit ISBN number.<br/>"; include"ISBN_val_include.html"; } else{ print"<h3>INVALID</h3><br/>"; print"$ISBN is an INVALID 10 number ISBN.<br/>"; include"ISBN_not_val_include.html"; }//end is_valid if }//end }//end is set if else{ include"ISBN_val_include.html"; }//end isset else ?> </form> <p><a href="_ShowISBN10and13DBProject.php">Show ISBN </a></p> </body> </html> This is the second part of the code that incorporates php and MySQL: <?php if (empty($_POST['ISBN'])|| empty($_POST['isbn_type']) || empty($_POST['Valid_Invalid'])) echo "<p>You must enter a Valid ISBN 10 to Continue! Please Click your browser's Back Button to return to the input page of ISBN 10 with Database.</p>\n"; else { $DBConnect = @mysql_connect("xxx.xxx.xx.xxx", "xxxxxxxx", "xxxxxxxx"); if($DBConnect === false) echo"<p>Unable to conenct to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>"; else{ $DBName = "xxxxxxxx"; if (!@mysql_select_db($DBName, $DBConnect)) { $SQLstring = "CREATE DATABASE $DBName"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if ($QueryResult === FALSE) echo "<p>Unable to execute the query.</p>" . "<p>Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>"; else echo "<p>You are the first visitor!</p>"; } mysql_select_db($DBName, $DBConnect); $TableName = "isbn"; $SQLstring = "SHOW TABLES LIKE '$TableName'"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if ($QueryResult === FALSE) echo "<p>Unable to create the table.</p>" . "<p>Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>"; $ISBNum = stripslashes($_POST['ISBN']); $ISBNType = stripslashes($_POST['isbn_type']); $VaORIn = stripslashes($_POST['Valid_Invalid']); $SQLstring = "INSERT INTO $TableName VALUES(NULL, '$ISBNum', '$ISBNType', '$VaORIn')"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if($QueryResult === false) echo"<p>Unable to execute the query.</p>" . "<p>Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>"; else echo"<h1>Thank you for trying our ISBN 10 program!</h1>"; mysql_close($DBConnect); } } ?><!--End PHP Script--> This is the page where it is not working! <?php $DBConnect = @mysql_connect("xxx.xxx.xx.xxx", "xxxxxxx", "xxxxx"); if($DBConnect === false) echo"<p>Unable to conenct to the database server.</p>" . "<p>Error code " . mysql_errno() . ": " . mysql_error() . "</p>"; else{ $DBName = "xxxxxx"; if (!@mysql_select_db($DBName, $DBConnect)) echo"<p>There are no entries in the guest book!</p>"; else { $TableName = "isbn"; $SQLstring = "SELECT * FROM $TableName"; $QueryResult = @mysql_query($SQLstring, $DBConnect); if (mysql_num_rows($QueryResult) == 0) echo"<p>There are no entries in the ISBN 10 Database!</p>"; else{ echo"<p>The following ISBN have been recorded:</p>"; echo"<table width='100%' border='1'>"; echo"<tr><th>ISBN Number</th><th>ISBN Type</th><th> Date Entred</th><th> Valid OR Invalid</th></tr>"; while (($Row = mysql_fetch_assoc($QueryResult)) !==FALSE) { echo "<tr><td>{$Row['ISBN']}</td>"; echo "<tr><td>{$Row['isbn_type']}</td>"; echo "<tr><td>{$Row['TIMESTAMP']}</td>"; echo "<td>{$Row['Valid_Invalid']}</td></tr>"; } } mysql_free_result($QueryResult); } mysql_close($DBConnect); } When I click show ISBN nothing happens and I am not shore why! This is how I have my table setup in MySQL Manually by clicking table and create table: Columns: count int(11) Al PK ISBN varchar(45) isbn_type varchar(45) TIMESTMP datetime PK Valid_Invalid varchar(45) Can someone please tell me why when I click Show ISBN in the input page the first code pasted I get nothing! How do I fix the issue because my validation works, but it's not storing it or showing up when click Show ISBN! Any help will be appreciate it!
  7. This code is taken from http://itfeast.blogspot.in/2013/08/php-convert-timestamp-into-facebook.html How would you actually show this on a page? Say I have a mysql table with date column and I would like to insert the results of this code in there and as well as show it on page, how would that be done? $today = time(); $createdday= strtotime($post['created']); //mysql timestamp of when post was created $datediff = abs($today - $createdday); $difftext=""; $years = floor($datediff / (365*60*60*24)); $months = floor(($datediff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($datediff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); $hours= floor($datediff/3600); $minutes= floor($datediff/60); $seconds= floor($datediff); //year checker if($difftext=="") { if($years>1) $difftext=$years." years ago"; elseif($years==1) $difftext=$years." year ago"; } //month checker if($difftext=="") { if($months>1) $difftext=$months." months ago"; elseif($months==1) $difftext=$months." month ago"; } //month checker if($difftext=="") { if($days>1) $difftext=$days." days ago"; elseif($days==1) $difftext=$days." day ago"; } //hour checker if($difftext=="") { if($hours>1) $difftext=$hours." hours ago"; elseif($hours==1) $difftext=$hours." hour ago"; } //minutes checker if($difftext=="") { if($minutes>1) $difftext=$minutes." minutes ago"; elseif($minutes==1) $difftext=$minutes." minute ago"; } //seconds checker if($difftext=="") { if($seconds>1) $difftext=$seconds." seconds ago"; elseif($seconds==1) $difftext=$seconds." second ago"; } echo " | ".$difftext;
  8. Hey im trying to make a small little game for my self at the moment, to test my self a little, the game i creating is based a little on the game http://ogame.org, im trying to find out how i can make the ressources auto increase on each member created on my site as the site ogame has, i dont need the javescript so you can see it auto increase, but just need to refresh it and then i can see that it has gone up, in my game im using Gold, Silver and Copper as ressources atm, and im not sure how to make the number in my database auto increase while the user have logged out, i was thinking about using some kind of function that would increse copper with 1 for each sec there goes with a timestamp or something like that, any of you guys knows how this could be possible? Regards Dan Larsen
  9. Can any one tell me what's wrong with this code? it's just keep giving me this message "Pick up Date atleast 24hrs after the current Date"; $pDate = $_GET['txtPDate']; $pTime = $_GET['txtPTime']; $dateArray = explode('-',$pDate); $timeArray = explode('.',$pTime); $hours = (int)$timeArray[0]; $minutes = (int)$timeArray[1]; $day = (int)$dateArray[0]; $month = (int)$dateArray[1]; $year = (int)$dateArray[2]; $userPTimes = mktime(date($hours),date($minutes),0,date($month), date($day), date($year)); $userCurrentTime = mktime(0, 0, 0, date($day), date($month), date($year)); $userupperlimit = mktime(date(7), date(30), date(0), date($day), date($month), date($year)); $userlowerlimit = mktime(date(20), date(30), date(0), date($day), date($month), date($year)); $dayafter = mktime(0, 0, 0, date($day +1), date($month), date($year)); // I wanted $dayafter to 24 hours after the $pdate if($userCurrentTime < $dayafter) { echo "Pick up Date atleast 24hrs after the current Date"; } else if(!($userPTimes >= $userupperlimit) || !($userPTimes <= $userlowerlimit )) { echo "Pick up Time should be between 7.30 - 20.30"; }
  10. Is there a way to add a timestamp when finished uploading to server? For example: An image named Testing.jpg is uploaded to the server. I want it to automatically be renamed to 2013_08_22-15:09:27-Testing.jpg (Year_Month_Day-Hour:Minute:Second-FILENAME.EXTENSION) Maybe the following code could help you while fixing my script. $date = new DateTime(); echo $date->format('U = Y_m_d-H:i:s') My current code: PS: I have only recently started to learn PHP coding (About 3 days ago)
  11. Hi guys, I found that this much asked question on the net has no real straight forward answer. So i ask this again. $date = ('2013-07-08 12:30:30'); how can i change this date to a Unix time stamp in the simplest possible manner just as it is possible to convert a timestamp to datetime in one line. Thanks to all again.
  12. Hi there! I currently have a form that posts the data to a MySQL database. How would I go about having it automatically add a timestamp (to the form entry) in the database as well, every time the from is submitted by a different user, this way I always know the original date/time of reception? Additionally, I also have a user-interface that displays the submitted form data, how would I go about pulling that timestamp from the database so that each entry also displays the timestamp. Thanks for your help.
  13. Hi, I need a script that ask user to input from name, from email and to, subject, message and also user defined timestamp value. I need this script to send a mail from back or future date. The script should accept timestamp input via user. Hope i will get my answer here. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.