oh my fucking god php is such a fucking trainwreck
in particular its date handling leaves QUITE A LOT to be desired
I mean there's also the big security hoobajoob but that's not the bit that's frustrating me at the moment
Discussion
oh my fucking god php is such a fucking trainwreck
in particular its date handling leaves QUITE A LOT to be desired
I mean there's also the big security hoobajoob but that's not the bit that's frustrating me at the moment
out of desperation I asked Gemini and it gave answers which look correct but involve writing a LOT more code than should be necessary for this
okay to be fair the easy way I'd do this in Python would involve importing arrow but it'd still result in a nice simple oneliner
but gosh, so much of the php standard library is just a thin wrapper around the C standard library, with a little bit of jank-ass object conversion
this isn't even for a thing I care about per se, I was just surprised to learn that a thing I wrote like 20 years ago and occasionally glance at has been doing it based on gmtime this whole time, since I usually only look at it in the morning
@fluffy
The webserver likely isn't in anybody's timezone so its locale stuff is going to be wrong for 24/25ths of the globe.
Turn it to a time_t and feed it to js on the client side and it might even show up in their language for free!
(Sorry for the "just don't do that then")
@EndlessMason this is for a personal non-public thing and the webserver is in the target audience's time zone (i.e. mine)
searching stackoverflow only finds things that are either wildly incorrect or answering a completely different question (often a different question than what's being asked too)
all I'm trying to do is get the numeric day of the week in the local timezone
date("W") goes based on GMT or needs a UNIX timestamp in localtime
localtime() returns a structured datetime array and I don't see any way to convert that into a UNIX timestamp
I don't see any way to do date formatting based on a datetime array
what a miserable fucking language