Posts

Showing posts with the label HTML

Dates in JSON

What format is the right one in JSON? "Or best? Is there any sort of standard on this?" "DateTimes in JSON are hard. The problem comes from the JSON spec itself: there is no literal syntax for dates in JSON. The spec has objects, arrays, strings, integers, and floats, but it defines no standard for what a date looks like." A common date/time-format used is ISO 8601. It is also used widely in libraries such as JavaScript's toJSON-method and Json.NET . In principle this turns the DateTime string into: <YYYY-MM-DD>T<HH:MM>[:SS.SSS][[+|-]HH:MM[:SS]|Z] Example: { "lastPlayedDateTime": "2021-12-28T23:30:00+01:00" } What's the Z? Z depicts the shorthand notation for UTC times, e.g. "2009-02-15T00:00Z" . Sources: Serializing Dates in JSON StackOverflow What is the "right" JSON date format? Wikipedia on ISO 8601 toJSON-method JSON spec

HTML: name vs id

Are they the same? Not if there is an article on it: name: identifies the HTML control, if things go up to the server id: identifies the HTML control for client-side scripting Sources: Introduction to ASP.NET MVC (Published: 09 August 2014), Customizing Controllers @~27min