Feed aggregator
CodeSOD: Time to Change
Dennis found this little nugget in an application he inherited.
function myTime(){ $utc_str = gmdate("M d Y H:i:s", time()); $utc = strtotime($utc_str); return $utc; }time() returns the current time as a Unix timestamp. gmdate then formats that, with the assumption that the time is in GMT. strtotime then parses that string back into a timestamp, and returns that timestamp.
Notably, PHP pins the Unix timestamp to UTC+00:00, aka GMT. So this function takes a time, formats it, parses the format to get what should be the same time back.
And we call the function myTime because of course we do. When reinventing a wheel, but square, please do let everyone know that it's yours.
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.Petroleum Drilling Technology Is Now Making Carbon-Free Power
Read more of this story at Slashdot.
Sysadmins Rage Over Apple's 'Nightmarish' SSL/TLS Cert Lifespan Cuts
Read more of this story at Slashdot.
Trump's Coin Sale Misses Early Targets As Crypto Project's Website Crashes
Read more of this story at Slashdot.
Cisco Investigates Breach After Stolen Data For Sale On Hacking Forum
Read more of this story at Slashdot.
Global EV Sales Up 30.5% In September
Read more of this story at Slashdot.
Intel and AMD Form an x86 Ecosystem Advisory Group
Read more of this story at Slashdot.
Apple Announces New, Faster iPad Mini Built For Apple Intelligence
Read more of this story at Slashdot.
Spotify Criticized For Letting Fake Albums Appear On Real Artist Pages
Read more of this story at Slashdot.
FCC Launches Formal Inquiry Into Why Broadband Data Caps Are Terrible
Read more of this story at Slashdot.
Apple Study Reveals Critical Flaws in AI's Logical Reasoning Abilities
Read more of this story at Slashdot.
More Colleges Set To Close in 2025, Even as 'Ivy Plus' Schools Experience Application Boom
Read more of this story at Slashdot.
Google's Chrome Browser Starts Disabling uBlock Origin
Read more of this story at Slashdot.
SSD Prices Set To Fall 10% in Q4 as AI PC Demand Lags - TrendForce
Read more of this story at Slashdot.
National Archives Pushes Google Gemini AI on Employees
Read more of this story at Slashdot.
Vietnam Plans To Convert All Its Networks To IPv6
Read more of this story at Slashdot.
Cost of Dealing With PFAS Problem Sites 'Frightening', Says Environment Agency
Read more of this story at Slashdot.
India Agrees With Musk in Satellite Spectrum Allocation Row
Read more of this story at Slashdot.
Why OpenAI Is at War With an Obscure Idea Man
Read more of this story at Slashdot.
Murder Trial Begins For US Tech Consultant Accused In Death of Cash App Founder
Read more of this story at Slashdot.