strtotime Questions

6

Solved

I want to echo the dates from Mo,Tu,We,Th,Fr,Sa,Su of the next week. My code looks like this at the moment: $date_monday = date("Y-m-d", strtotime('next monday')); $date_tuesday = date("Y-m-d", s...
Measles asked 23/11, 2013 at 12:4

15

Solved

I'm trying to get a date that is one year from the date I specify. My code looks like this: $futureDate=date('Y-m-d', strtotime('+one year', $startDate)); It's returning the wrong date. Any ide...
Scroggins asked 15/12, 2009 at 3:48

8

Solved

I have this variable: $timestamp = strftime("%Y-%m-%d %h:%M:%S %a", time ()); I simply want to add three hours and echo it out. I have seen the way where you can do the 60 * 60 * 3 method or th...
Paterson asked 18/6, 2012 at 2:26

16

Solved

I need to get previous month and year, relative to current date. However, see following example. // Today is 2011-03-30 echo date('Y-m-d', strtotime('last month')); // Output: 2011-03-02 This ...
Flashbulb asked 30/3, 2011 at 16:56

2

Solved

What is a Unix timestamp? In PHP, when working with dates, the function strtotime() outputs some integer value -- what is that? I tried to learn about this but I couldn't get satisfactory answer, e...
Tremolite asked 29/12, 2013 at 6:44

6

Solved

This post almost answered this question for me, but I have a specific need and didn't find what I sought there. This lies right outside my experience; couldn't quite wrap my head around it, so all ...
Sapiential asked 22/2, 2013 at 4:15

7

Solved

For example the: 3rd Monday of January for Martin Luther King Day 3rd Monday of February for Presidents' Day (Washington's Birthday) Last Sunday of March for Easter Last Monday of May for Mem...
Chesney asked 16/2, 2013 at 6:12

11

Solved

I have a variable called $effectiveDate containing the date 2012-03-26. I am trying to add three months to this date and have been unsuccessful at it. Here is what I have tried: $effectiveDate =...
Terrence asked 26/3, 2012 at 15:33

4

Solved

I have 2 unix timestamps, I'm in AsiaPacific/Auckland timezone (GMT+12, DaylightSavings = GMT+13) I want to calculate the number of days interval between 2 timestamps, where one is inside daylight...
Simmon asked 20/9, 2010 at 13:3

3

Solved

I'm trying to get the date from the week number, day number and year. For eg: week number = 52 day number = 4 (of week 52) year = 2013 In this case, the date should be 26-12-2013. How can I...
Verleneverlie asked 26/12, 2013 at 7:20

12

Solved

I have a Unix timestamp like this: $timestamp=1330581600 How do I get the beginning of the day and the end of the day for that timestamp? e.g. $beginOfDay = Start of Timestamp's Day $endOfDay =...
Smackdab asked 17/4, 2012 at 19:33

2

if i have a date 10/10/2009 and i wanted to add strtotime(+# months) to display an expiration date? the 10/10/2009 is a start date which is imputed by the customer and the +# months is how ever ma...
Seton asked 15/9, 2010 at 22:52

10

Solved

I would like to check, if a date is today, tomorrow, yesterday or else. But my code doesn't work. Code: $timestamp = "2014.09.02T13:34"; $date = date("d.m.Y H:i"); $match_date = date('d.m.Y H:i',...
Savino asked 2/9, 2014 at 11:30

6

I have a datetime field (endTime) in mysql. I use gmdate() to populate this endTime field. The value stored is something like 2009-09-17 04:10:48. I want to add 30 minutes to this endtime and compa...
Ducal asked 17/9, 2009 at 5:26

4

Solved

The DateTime class sure has some handy methods and seems overall superior to the native PHP date functions like strtotime, mktime and strftime (and more). But is there any drawback or a reason why ...
Ruella asked 22/12, 2011 at 14:52

8

Solved

I have a problem getting the date of monday in the current week. echo date('Y-m-d',strtotime('monday this week')); When I'm running the above code on my local machine (PHP 5.3) it outputs correc...
Namesake asked 9/3, 2011 at 15:18

5

Solved

I want to display $row->depositdate in dd-mm-yyyy format. If the date column in database is null the date displayed is : 01-01-1970 echo "<td align=center>".date('d-m-Y', strtotime($row-&gt...
Cession asked 12/10, 2011 at 8:42

9

Solved

Say I have a string coming in, "2007-02-28", what's the simplest code I could write to turn that into "2007-03-01"? Right now I'm just using strtotime(), then adding 24*60*60, then using date(), bu...
English asked 18/3, 2009 at 23:34

10

Example: $startDate is Monday 2007-02-05 and $endDate is Tuesday 2007-02-20. Then I want it to list: Monday 2007-02-05 Monday 2007-02-12 Monday 2007-02-19 I looked at the PHP manual and found th...
Metastasize asked 15/8, 2011 at 4:53

8

Solved

I have a form in which date format is dd/mm/yyyy . For searching database , I hanverted the date format to yyyy-mm-dd . But when I echo it, it showing 1970-01-01 . The PHP code is below: $date1 = ...
Sidonnie asked 24/1, 2012 at 9:38

6

Solved

I have these lines: $staticstart = date('Y-m-d',strtotime('last Monday')); $staticfinish = date('Y-m-d',strtotime('next Saturday')); And I am using them to select the monday and saturday of the...
Othello asked 10/12, 2013 at 6:34

6

Solved

I'm trying to figure out the first wednesday of a given month using strtotime, but the "first wednesday" argument fails whenever the first wednesday happens to fall on the 1st. For a more general ...
Cyrene asked 5/12, 2010 at 5:15

7

Solved

Is there a way to use strtotime to add working days (Monday to Friday) to a date? Or some other method? What I want to do is: date ( 'Y-m-j' , strtotime ( '+3 working days' ) )
Rickrickard asked 23/11, 2010 at 21:33

5

Solved

I have two variables containing strings of dates in the format $four_days_have_passed = "07-14-2013"; $now = "07-10-2013"; I have checked the output in FirePHP and the dates are correct. Then ...
Nitrogen asked 9/7, 2013 at 23:17

4

Solved

I need to output a list of dates (only Mondays and Tuesdays) for the next 12 months from current date like so: Jan 2010 Tue 12 Jan 2010 Mon 18 Jan 2010 Tue 19 Jan 2010 Mon 25 Jan 2010 Feb 2010 T...
Belorussia asked 11/1, 2010 at 23:36

© 2022 - 2024 — McMap. All rights reserved.