strtotime Questions
7
Solved
It seems like a lot of people struggle with date/time issues in PHP, and inevitably, many of the accepted answers tend to be "Use strtotime in this way."
Is this really the best way to di...
4
Solved
I'm using date()and strtotime() functions to display the next 3 months in a dropdown list.
PHP Code:
echo date("m/Y",strtotime("+0 months"));
echo date("m/Y",strtotime("+1 months"));
echo dat...
1
Solved
I have this code which through json_decode retrieves my latest tweets, their date, etc.
<?php setlocale(LC_ALL, 'it_IT'); ?>
<?php include("twitter_auth.php");
echo "<ul style='color:#...
7
Solved
I have a simple variable that adds one month to today:
$endOfCycle = date("Y-m", strtotime("+1 month"));
Today is January 2013, so I would expect to get back 2013-02 but I'm getting 2013-0...
2
I was asked to write a module for our billing system and completed it using all of the functions I am accustomed to. It was tested on an English setup, but I did not take into account (nor was I aw...
3
Solved
Quite simply in PHP I have a date of 8th January 2011, in the format 08-01-11 - when I run this into strtotime and convert it back into a different date format, it reverts back to 1st August 2011 -...
2
Solved
Possible Duplicate:
How to get previous month and year relative to today, using strtotime and date?
Today is December, 31st but strtotime("-1 months") returns December:
echo date("Y-...
1
Solved
Was googling this, but couldn't find the answer. Was wondering, if there is a difference in these two scripts?
+3 day:
echo date( 'd.m.Y H:i:s', strtotime( '+3 day' ) );
+3 days:
echo date( 'd...
2
Solved
I cant understand this - why does the following occur?
echo date("d-m-Y", strtotime($str));
$str = '214454'; // Produces todays date
$str = '333333'; // Produces 1-1-1970
$str = 'a' (or ANY singl...
1
Solved
Possible Duplicate:
A non well formed numeric value encountered
Why doesn't this work?
echo gmdate('Y-m-d H:i:s',strtotime('+7 days','2035-01-01 00:00:00'));
The error I see is:
...
1
Solved
I need to subtract 45 minutes from the date-time variable in PHP.
The code:
$thestime = '2012-07-27 20:40';
$datetime_from = date("Y-m-d h:i",strtotime("-45 minutes",strtotime($thestime)));
echo ...
3
Solved
Following is the function which I have created for getting sunday as a starting day of a week,
function getCurrentIntervalOfWeek($liveratetime) {
// get start of each week.
$dayofweek = date('w...
6
Solved
I am not sure why strtotime() in PHP returns different result in different timezone even though same date is given as parameter, does anyone know the answer? I also want to know, can I do similar t...
Thaw asked 3/9, 2011 at 18:55
3
Solved
I'm looking for a reliable way to return the full date of a specified weekday (e.g. "Mon") for the current week.
Since today is Wednesday, June 13, 2012, I expected <?php echo date("Y-m-d", str...
3
I am trying to display dates in the European format (dd/mm/yyyy) with strtotime but it always returns 01/01/1970.
Here is my codeline :
echo "<p><h6>".date('d/m/Y', strtotime($row['DM...
5
Solved
$somedate = "1980-02-15";
$otherdate = strtotime('+1 year', strtotime($somedate));
echo date('Y-m-d', $otherdate);
outputs
1981-02-15
and
$somedate = "1980-02-15";
$otherdate = strtotime('+2 ...
3
Solved
I know the year and the day of year (0-365).
Is there any way to get back from it to timestamp?
Something like:
$day=date('z');
$year=2012;
$timestamp=strtotime($day.'-nd day of '.$year);
10
Solved
Is there a way to check to see if a date/time is valid you would think these would be easy to check:
$date = '0000-00-00';
$time = '00:00:00';
$dateTime = $date . ' ' . $time;
if(strtotime($dateT...
1
Solved
I have a table which contains members signups and I would like to be able to start doing some charting and analysis on the data and look for signup trends etc so I would like to be able to plot a l...
6
Solved
I wrote this piece of code
echo date("Y-m-d", strtotime($date, strtotime("+ " . $days . " days")));
$date = 2012-04-12
$days = 15
I am looking to add $days (15 days) to the date (2012-04-12) I ...
5
Solved
I am trying to create a select list starting from the current date of the user. I want it so that it is set to midnight in unix timestamp format.
This is all I'm doing:
$today = strtotime('today'...
Linis asked 31/3, 2012 at 16:22
2
In PHP and MySQL - how to determine if the Store is Open or Close (return true or false)?
Also how to get the next opening hours if the store is closed?
Example of Opening_Hours table:
+----+---...
Vote asked 3/3, 2012 at 12:38
8
Solved
I noticed that strtotime() handles unix timestamps in an odd way, and I was curious if anyone knows why that is:
var_export(strtotime('1330725042')); // false
var_export(strtotime('@1330725042'));...
2
Solved
Simple question, but I couldn't find any related topics that match this exact scenario. Everything I found involved MySQL or date and time rather than just time.
I have a timestamp stored in a var...
4
Solved
© 2022 - 2024 — McMap. All rights reserved.