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...
Borgeson asked 13/3, 2011 at 3:33

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...
Wendell asked 30/1, 2012 at 1:52

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:#...
Amnesia asked 6/2, 2013 at 19:26

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...
Delve asked 29/1, 2013 at 13:30

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...
Tolbutamide asked 24/1, 2013 at 12:24

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 -...
Limelight asked 12/11, 2010 at 10:23

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-...
Hendrix asked 31/12, 2012 at 14:14

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...
Juliusjullundur asked 20/9, 2012 at 9:11

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...
Auditor asked 3/9, 2012 at 12:58

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: ...
Knight asked 14/8, 2012 at 17:56

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 ...
Prenotion asked 27/7, 2012 at 13:33

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...
Prepay asked 21/3, 2011 at 10:38

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...
Sofar asked 13/6, 2012 at 19:56

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...
Stepp asked 8/6, 2012 at 9:41

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 ...
Intransigeance asked 7/6, 2012 at 2:24

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);
Archilochus asked 8/5, 2012 at 13:56

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...
Accede asked 26/9, 2008 at 19:5

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...
Dissuasion asked 21/4, 2012 at 13:50

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 ...
Subtitle asked 12/4, 2012 at 18:8

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'));...
Aphaeresis asked 2/3, 2012 at 21:53

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...
Mandler asked 7/1, 2012 at 18:28

4

Solved

I need help getting the previous months full date range in the following format: Y-m-d I have successfully been able to get "this" months full date range but not the "previous" months full date ra...
Forging asked 1/1, 2012 at 18:57

© 2022 - 2024 — McMap. All rights reserved.