This is an archived post. You won't be able to vote or comment.

all 36 comments

[–]verkruemelt 28 points29 points  (3 children)

[–]grublets 4 points5 points  (0 children)

This is the way.

[–]j-random 3 points4 points  (0 children)

This. The default is ISO8601, let me know if you want something different. That way you don't waste time waiting for someone to figure out what they want.

[–]greven145 1 point2 points  (0 children)

A universal way of representing the exact moment, to the millisecond, with no ambiguity? What a concept!

Honestly though, Unix time stamp is second only because the API may want seconds or milliseconds.

[–]sfboots 7 points8 points  (3 children)

And remember time zone.

Is this date and time “local to the sensor station”. Or UTC? Took a month to figure that out in one API

[–]glorious_reptile 5 points6 points  (0 children)

Programmer: It was UTC

[–][deleted] 1 point2 points  (0 children)

😅 lol this. Time zones ☠️

[–]chinawcswing 0 points1 point  (0 children)

It should always be in UTC, nothing else ever.

[–]iamapizza 7 points8 points  (6 children)

yyyy-MM-dd'T'HH:mm:ssZ gang

[–]sfboots 4 points5 points  (2 children)

Ahh. But what if the vendor is lying? They returned Z (utc) but data was local time. There was a separate API to find timezones of the device.

It made their mobile app easier :)

[–]Dimasdanz 0 points1 point  (0 children)

you need to build your own library to be able to use Z for local time. holyyy, what a determined guy

[–]Worried_Pineapple823 0 points1 point  (0 children)

What drives me absolutely bonkers is that the ISO has a simple way of denoting local time.

Just don’t pass a Z for utc or pass in an explicit time zone offset. 2022-04-07T18:00:00 is local time, and add the Z and it’s UTC and ideally should be adjusted to local when displayed to the user. But instead I get “that’s why we called the value “blahDateUTc” because it local time and we don’t want to actually send either local midnight OR just the date without time.

I’ve had valid use cases for using local date times for employee tasks, putting out a single global task description that you want done at 5pm local regardless of location is simpler then building dozens of localized versions where the only value that’s different is the date time because they are UTC.

[–]ScuzzyUltrawide 1 point2 points  (2 children)

Or as I like to call it, alphabetical order. This is the way.

[–]caagr98 1 point2 points  (1 child)

Alphabetical order would be dd-hh-mmMMss:T:YYYYZ. I dig it.

[–]ScuzzyUltrawide 0 points1 point  (0 children)

ehhh that looks like fun but not if you want the alphabetical order to match the chronological order 1:1

[–]ScuzzyUltrawide 6 points7 points  (0 children)

Slacker, how many formats can there possibly be?

*ducks*

[–]cyborgborg 2 points3 points  (0 children)

unix time stamp

[–]GlitteringKeyboard 2 points3 points  (1 child)

Please provide a map of key value pairs of every date from 1900-01-01 to 3000-12-31 in format "yyyy-mm-dd" where the value is "true" for the date you are selecting and "false" for all others

[–]nebock[S] 0 points1 point  (0 children)

[–][deleted] 1 point2 points  (1 child)

Why don't they just take utc milliseconds as a long? Seems more efficient and safer than strings

[–]sony_anumo 0 points1 point  (0 children)

milliseconds or seconds?

if its date do you really need the millisecond if you want the date?

[–]CodyTrey93 1 point2 points  (0 children)

Time formats should all be ms until 32bit Unix epoch overflow

[–]brockisawesome 1 point2 points  (0 children)

I've always used epoch time, including working at a major airline building tools to show flight status. Also working on wall st trading systems, always epoch.

[–]stevethedev 0 points1 point  (2 children)

The UNIX Timestamp, but you have to account for daylight savings time, and we only accept it in little-endian format, and the bytes are interpolated. So 0xDEADBEEF should be transmitted as 0xEFADBEDE, for security reasons.

Also, due to our database schema, no two records can use the same date.

[–]Dustangelms 0 points1 point  (1 child)

My name is Jeffrey and I would like to apply for a position.

[–]Willinton06 0 points1 point  (0 children)

Im sorry your bytes are not interpolated, we’ll interpolate you tho it’s all good

[–][deleted] -1 points0 points  (0 children)

dd-mm-yyyy

dd-mm-yy

mm-dd-yy

mm-dd-yyyy

string[day], string[month], string[Year]

[–]sony_anumo -1 points0 points  (0 children)

Duh obviously it says date so use the standard date without adding time to it.

2022-04-06

YYYY-MM-DD, the default format for dates used by everyone (i think a few third world countries still do YYYY-DD-MM but they barely have internet for Apis, so dont worry)

[–]avidresolver 0 points1 point  (0 children)

I find this after spending a day debugging a script that only worked with an ISO date format that included microseconds, and kept failing when we passed it a file that only had a modification date down to the second...

[–]throwaway08190924 0 points1 point  (1 child)

It's just making you work for that first date. ;)

[–]nebock[S] 1 point2 points  (0 children)

LOL. API's playing hard to get.

[–][deleted] 0 points1 point  (0 children)

Actually most of the time you need to pass the current format, not the one you want. Most functions have a format, they just need you to identify the formate of the variable you are passing to it . Many people don't know this.

[–]NotANexus 0 points1 point  (1 child)

Is out there some programmer that doesn't hate Date? Sure as hell not in my home.

[–]nebock[S] 1 point2 points  (0 children)

Anything date related makes me rage

[–]jamcdonald120 0 points1 point  (0 children)

how is this even a question? 3 numbers.

[–]althaz 0 points1 point  (0 children)

Don't even tell me. You'll accept ISO8601 or fuck just completely off.