strtotime Questions
3
Solved
I've seen a few questions about this but not a clear answer... strtotime() will use the default timezone set for PHP when converting the string to a unix timestamp.
However, I want to convert a st...
8
Solved
My code works fine if the times are AM to PM (Ex: 11 AM - 10 PM), but if the locations hours of operation are AM to AM (Ex: 9 AM - 1 AM) it breaks. Here is my code:
$datedivide = explode(" - ", $d...
7
Solved
Yesterday I ran into an issue with PHP's strtotime not properly adding a month. On '2011-05-31' I ran:
date('Y-m-d',strtotime( '+1 month', strtotime('now')));
Which returns '2011-07-01' when I a...
4
Solved
I wrote this piece of code in order to display the current date + 2 months :
<?php
$date = date("d/m/Y");
$date = strtotime(date("d/m/Y", strtotime($date)) . "+2 months");
$date = date("d/m/...
9
Solved
Does strtotime only work in the default language on the server? The below code should resolve to august 11, 2005, however it uses the french "aout" instead of the english "aug".
Any ideas how to h...
Fumble asked 8/8, 2011 at 21:1
6
Solved
I can't beleive I've never come across this one before.
Basically, I'm parsing the text in human-created text documents and one of the fields I need to parse is a date and time. Because I'm in Aus...
4
Solved
I want to add 30 minutes and then one hour to my variable which i already have my own date
var initialDate = '10:00';
So
if (some condition){
// i add 30 minutes ->10:30
}elseif(another co...
Arica asked 21/3, 2017 at 11:34
10
Solved
I have a PHP date in the form of 2013-01-22 and I want to get tomorrows date in the same format, so for example 2013-01-23.
How is this possible with PHP?
3
Solved
I am trying to get the timestamp of the first day of the month at 00:00:00.
For example, the timestamp of Jan 01 2012 00:00:00
I'm doing this:
$test_month = time(); // Seconds
$test_month = date...
2
Solved
I want to give date() a date and have it return if that date is DST or not. Running PHP 5.4.7 via xampp on a windows 7 box. A linux box running PHP 5.2.8 returns 0 no matter what date I give it.
W...
3
Solved
I'm limiting my query to use show post from 6 months ago which works fine.
But I need it to be based on a date that is in the post_meta table instead of 'post_date_gmt'.
In my case I have meta_ke...
7
Solved
Having a nightmare at the moment and just can't see why it isn't working
I have a value in the form H:i (ie 10:00, 13:30) etc called $time
What I want to do is create two new values, $startTime w...
4
Solved
I have this string object in my php array
"2013-03-05 00:00:00+00"
I would like to add 12 hours to the entry within PHP, then save it back to string in the same format
I believe this involves co...
8
Solved
I want to use strtotime("last Monday").
The thing is, if today IS MONDAY, what does it return?
It seems to be returning the date for the monday of last week. How can I make it return today's date...
5
Solved
I got an issue on below script, assume $exp_date is retrieved from db, I want to compare expiry date with today date to check whether membership's is still alive.
There is nothing to display but o...
2
SO the scene is, I have a store which opens at 1:00am at night, and closes at 10:00pm.
For any current time i just want to check whether that timestamp lies between store open and close times.
Yea...
Shemikashemite asked 1/9, 2016 at 21:39
2
I am trying to get the time passed between two datetime strings (including milliseconds)
example:
$pageTime = strtotime("2012-04-23T16:08:14.9-05:00");
$rowTime = strtotime("2012-04-23T16:08:16.1...
3
Solved
I have date format like '25 May 2016 10:45:53:567'.
I want to convert into the time stamp.
strtotime function returns empty.
$date = '25 May 2016 10:45:53:567';
echo strtotime($date);
// return...
Arnold asked 28/5, 2016 at 10:2
4
Solved
If i have a varible
// in minutes
$min = 40;
And i want to add it to a strotime formatted time
$strtTime = $strtotime('now') + $min;
whats the correct way to do this?
5
Solved
i am making some statistics, i want to select the time from (last week only) and this week.
for this week its easy:
$start = strtotime('this week');
$finish = time();
for last week
$start = st...
6
Solved
This was working fine yesterday with no changes to the code.
echo date("M", strtotime("-3 month", time()) );
echo date("M", strtotime("-2 month", time()) );
echo date("M", strtotime("-1 month", ti...
2
Solved
I'm trying to understand the following behavior of the date function strtotime():
strtotime(1420066800) returns false, as expected.
strtotime(1451602800) returns 26197048320! But expected false a...
8
Solved
I know about the unwanted behaviour of PHP's function
strtotime
For example, when adding a month (+1 month) to dates like: 31.01.2011 -> 03.03.2011
I know it's not officially a PHP bug, a...
3
I am working on a script that will import some data from a CSV file. As I am doing this I want to be able to check a variable to see if it is a valid date string.
I have seen several ways to chec...
9
Solved
I need to check in PHP if the current time is before 2pm that day.
I've done this with strtotime on dates before, however this time it's with a time only, so obviously at 0.00 each day the time wi...
© 2022 - 2024 — McMap. All rights reserved.