dlite922 1,584
Recognized Expert Top Contributor
I'm not sure if it's a bug or maybe some weird way strtotime() works, but I need dates for
1. Second Sunday of March
2. First Sunday of November
for any given year (mostly current year).
This -
-
echo "SPRING DST = " , date('M d Y ',strtotime("Second Sunday March")) ,
-
"<br>FALL DST = " , date('M d Y ',strtotime("First Sunday November"));
-
-
-
Outputs: -
SPRING DST = Apr 05 2009
-
FALL DST = Nov 29 2009
-
-
//expected Output
-
SPRING DST = Mar 08 2009
-
FALL DST = Nov 01 2009
-
I tried other input variations and got other false outputs.
What gives?
Dan
1 2420 dlite922 1,584
Recognized Expert Top Contributor
Well, I finally stumbled on something that gives me that.
Here you go: - echo "SPRING DST = " , date('M d Y ',strtotime("March 2nd Sunday")) ,
-
"<br>FALL DST = " , date('M d Y ',strtotime("November 1st Sunday"));
-
-
//outputs:
-
SPRING DST = Mar 08 2009
-
FALL DST = Nov 01 2009
-
Hope that helped you,
Dan
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Pjotr Wedersteers |
last post by:
I'm using strtotime to get the timestamp for midnight. I have a statistics
script for my pagecounter that displays hits since midnight.
I also display the number of hours and minutes passed since midnight.
$start = strtotime ('today 00:00');
$timepassed = date ('H:i', time () - $start);
The weird part is at 11.30 AM it says 12 hrs and 30 minutes have passed.
I tried adding GMT+1 like so: $start = strtotime ('today 00:00 GMT+1');...
|
by: Dawid Szałęga |
last post by:
Hi,
I do something like this:
$month = date('m', strtotime('2004-09-30 +5 months'))
This give me 03 (March), but 09 (September) + 5 months should give me 02
(February)
It's bug or I thing wrong?
--
|
by: peabody |
last post by:
I'm trying to use the strtotime() function to manage sessions. But I
get the following
<?php
print(time() . " - " . strtotime("+1 hour"));
?>
outputs:
1097380666 - 1097308800
|
by: Rithish |
last post by:
Hello. I noticed a strange thing while using strtotime() and date()
functions in combination to generate from MySQL into a readable format.
By default, the MySQL date field will be 0000-00-00 00:00:00 When I
pass this to strtotime() to generate the timestamp, and then pass it to
the date function, it generates 30-11-1999.
<?
print ( "<br> strtotime for '0000-00-00 00:00:00' : " . strtotime (
|
by: Allen Maki |
last post by:
/*
I am trying to practice multidimensional array in a managed class using
dynamical allocation.
If I tried to compile the following codes, I would get the under mentioned
c2440 error message. It is only practice. You may notice that I am not using
"private"
| |
by: cassbiz |
last post by:
I am using strtotime and I have read up on some examples and am getting the wrong output, it jumps by several days instead of one day at a time.
Ultimately what I am trying to accomplish is to set up an arrival time and a departure time for the script. This is using AJAX (which I am such a newbee @) from my earlier post http://www.thescripts.com/forum/threadnav583131-1-10.html
Any help is greatly appreciated.
<?
$output = '';
|
by: Chris |
last post by:
I am trying to output Monday of the current week i.e. if Monday is the
8th I want to display 'Monday 8th' for any date between Monday 8-14th.
I would appreciate any help, the code below is heading in the right
direction but doesn't quite give me the results I am looking for.
$givenday = mktime(0,0,0,10,08,2007);
$Monday = strtotime("Monday this week",$givenday);
echo date("j M Y H:i:s", $Monday);
|
by: Erwin Moller |
last post by:
Hi group,
I have been using strtotime a lot in my code.
I wonder if I made a mistake in my thinking. :-/
Here follows a stripped down example.
consider some dates:
$date1 = "2008-02-23";
$date2 = "2008-02-23";
(They are the same)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |