Entity Framework Community Standup - Noda Time

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] do [Music] [Music] [Applause] [Music] hello welcome to uh another financially framework community stand up uh coming you to you today from various european time zones we have uh with us uh john skeet who's gonna tell us how to or teach us how to know the time uh here also with shai from the af team who's uh going to show us a bit later some of the uh no the time integration with af gore for you can use it with sql server postgres and sqlite so i think we're going to skip the state of the unicorn this week ef course 6-0 is coming out very soon coincidentally or perhaps not dot net conf is coming up very soon as well um two ef sessions there so uh get the daily build which is basically the ga bits right now try it out and then see us dot net conf um so let's uh turn it over to john to have a discussion about know the time john cool thank you uh and i do want this to be a discussion rather than the lecturing and i do i have a tendency to go on a bit and personally or has been on a podcast with me or whatever we'll find out so i have a tendency to interrupt a bit so that's going to work out there you go which i've just done just now good yes test complete um so when did i start with the background to how noda time came about uh so sort of history lesson um when i first joined google hi vijay's got an excellent question what is noda time so know the time is an alternative date and time library for net um and it's been around for a long time the history being when i first started at google which was in 2008 um i initially worked on google mobile sync which was for synchronizing calendar contacts and emails uh between well between your google calendar etc and initially it was aimed at syncml devices so phones that were um syncing lm enabled which were mostly nokias from what i remember and a colleague of mine had a 20 project to to see whether we could support this new and newfangled thing called the iphone which was really quite new um so this was pre-android completely right yeah absolutely um and we had the the iphone supported exchange synchronization via a protocol called activesync and so we implemented synchronization with google by effectively pretending to be an exchange server um as far as the active sync protocol was concerned yes um so is this entre factor of an apple device talking to google servers using a microsoft protocol um and what could go wrong in particular it turned out that other devices uh implemented uh active sync as well eventually um and they did so really really badly particularly with time zones um so time zones are represented in active sync if i remember rightly with there's some data structure that's got a binary representation but in active sync because of the limited data types it's represented in base 64. and bear in mind this is all about eight years ago so i may may well be wrong and you kind of get worried when it's more like 30 years ago some mobile device manufacturers can't even or couldn't then even get base 64 correct like there would just be invalid base64 it's like how on earth is this meant to work um anyway so i ended up doing the synchronization of calendars so use the google calendar api um and that got me into oh dates and times are kind of tricky and i started using the joda time library which this was before the java.time um side of things came about but it was effectively the the precursor to java.time which is the now preferred way of working with time in java right um so i started to use joe design great and also in 2008 as well as me starting at google stack overflow started it's a it's a little q a site you may have heard of yes um i believe you're on there a little bit yeah yeah and i just for those who don't know by the way because we didn't actually present john here john are you still the first the very first most highly reputable or whatever you call it a person yeah i think gordon will overtake me in about a year so this person right here is the top most user on stack overflow just in case people here were not aware there i had to say it so i i joined stack overflow in late september 20 2008 and uh i blogged i think the day after i joined saying hmm i think i might be spending some more time on this side yeah yeah very much so um and in i think it was late 2008 there were stack overflow dev days conferences one day conferences around the world um that were very very cheap so you didn't you didn't get food there you everyone went out to go to mcdonald's or wherever um and so anyone could show up uh pretty much and i was fortunate enough to get a speaking slot and i gave a talk on uh humanity epic failures or epic fail um how how humankind has screwed over computing uh blaming architects and uh developers and just ordinary users uh because we've all got a hand in in how bad things are as looking at numbers and text and dates and times you know three fundamental data types yes and how all of them are massively confusing and difficult the long story is nearly at an end i promise so i i gave a presentation on on dates and times and said you know one of the things to to try to manage all of this complexity is please use the right tool for the job and in java that means jodatime and in.net it means we haven't got anything yeah and on the way home from that conference literally if i remember rightly on the train on the way home i possibly wrote a blog post again i can't remember um saying i feel really guilty about this you know i'm a dot-net developer i won't support the net ecosystem how can i go on stage and say if you're working in.net we got nothing for you date time kind of sucks in various ways which we can talk about in a bit um i wonder how hard it would be to port joda time and yeah that was a really stupid thought to have [Laughter] just thinking of the many many many hours that i've spent since then um yes dear guys so no design came into being uh so clearly back then everything was n whatever you know n hibernate n units so yes and your time it wasn't going to be and joda time that would be silly um and i i hadn't even cottoned on to the whole do you know the time yeah i think if i had i don't know whether it would have made any any difference um i did a brief digression if i assume you do digressions on this yeah yeah obviously this whole show is a digression yeah so i did once think that i should write a testing framework and a mocking library that would work well together so um mocking is like insulting something so you would have insult nice and a tests are sort of judging your code so that would be end jury and they work well together very good insult to injury very very very nice yeah you shouldn't you should not have like you should not have publicized that idea somebody's going to steal it for sure you need to do it just because of the names yeah absolutely injury very nice anyway so now the time came about and uh i started off by taking the i started off porting jody time as directly as possible knowing that it would be a long time before we got to v1 um i corrected some of what i viewed to be the api mistakes as they as we went along and i'll talk about some of the design decisions and design goals of node time in a bit um i mean digression again but i always found it interesting coming from a java world into a.net world how many things that i mean not that microsoft copied java at all or anything not that it was a member-wise clone of java i think it was the uh was the joke at the time but speaking of member-wise clone it's like in the java world it was well known how bad clone was and that you shouldn't use it and yet don't that comes out and it's right there and you're like why did they do that along with ovarian's array types exactly yeah and unlock on every object yeah um we could have a whole other round about exactly why it was a mistake for to try to support java and yeah yeah yes uh what what was it jay uh what was the the visual i can't remember yes hey j sharp j sharp that's right yes like actually oh okay i'm sure there were good reasons at the time and seriously folks um i don't want to mock anyone making uh decisions that in hindsight look like a bad idea we've all done it it's so easy to do um anyway uh where have we got to so yeah um joda times started off uh with a sort of modified um api partly because jada time as well java didn't have custom value types back then obviously i wanted to use custom value types which meant i couldn't even if i wanted to use the sort of seven level deep hierarchy that jodot uses in some places they do love their inheritance yes i'm much much more of a design for inheritance or prohibited usually prohibited kind of person um and using value types here wouldn't have supported that anyway so the api was slightly different uh under the hood we kept a lot of the same internal engine but made it all internal got rid of a load of the everything in joda time is public not quite everything but large parts of it are public that probably no one else is going to want to do so you can you can create your own calendar system um i thought chances are if someone wants to create their own calendar system we're going to have to work with them really carefully because yeah there's a lot of detail there in which case could could you just put it into the library please and then you don't have to expose as many internals and it's like a case of premature abstractization or something like that right or yeah yeah customizability is it yes yeah we actually took a an interesting approach with ef core on this where we have everything is basically public like almost like 99.9 you know percent of everything is public um so that if people want to mess with the internals or they want to replace this service and do something funky they can but then we document it all as this is internal and we're going to break you if you use it so we kind of like trying and we have an analyzer that generates an analyzer but the line is very clear between what is really public and what is not this is the important part here yes that's yeah that's the important part yeah i think having is it in an internal namespace it is internal namespace and we can attribute as well so we yeah it's too late too that sounds good i think again a whole other show we could talk about virtually yeah yeah yes yes that can order time yeah back to note um so yeah the first implementation was uh really quite complicated because i didn't understand the code i was porting very well because you you don't as yeah when you're pausing a huge swathe you kind of port and then try to understand um and i ended up being able to simplify it really quite significantly so it started off being sort of modified api over jojo time engine and now it's modified api and extended api over something completely different so it's almost unrecognizable from nova time did you have tests coming from in the noda type in joda time that you could port over to help or was it like write your own tests or they had a lot of tests that seemed to be testing the implementation more than what was actually useful as it were yes um it's funny and i were talking about that the other day what is it you're actually testing that's a very important question yeah um and i give me two secs just to tell my daughter that i'm on a live stream okay [Laughter] where's arthur's cats that's usually what happens at some point well they they haven't been around that much because we've had trouble getting our heating started we actually had the the land lady lords representation representative come around here and fiddle with our radiators so um yeah so i don't know if how this will show up or not anyway um yeah unfortunately with my curtains closed you won't be able to see any of my cats they frequently i'm in a shed garden office kind of thing right now yeah you would see the garden behind and then the house behind that and they wow sometimes mess around in the garden behind me um yeah so notice i'm went to v1 i will have to see i was uh i enjoyed this i was at a user group meeting and i said you know is one of the reasons that people won't use note of time because it's not at ga yet and some people raised their hands and i hit return and said well that's okay then that's quite fun uh it was you know we're coming up to the anniversary it was the 7th of november 2012 so it's nearly 9 years old well um and and oh wraith two uh no the the shed is definitely not chilly partly because the amount of hardware in here that's going here just two laptops and a monitor um is enough to make a fair difference uh it's also very well insulated and i do have a radiator in uh but i don't usually need to use it um cool anyway so no design was born and then uh from in v1 we had 1.0 1.1 2 and 3 then we launched 2.0 and then 1.4 um which was a very deliberate strategy that we publicized beforehand because 1.3 to 2.0 was a was a change that was the reason we did it um however we thought well once we know for sure what the api for 2.0 will be which we'll only know when we launch it then we can write some things with extension methods etc to have a version 1.4 that was a sort of bridging thing we would mark things as obsolete as a warning but provide new extension methods so that you could very nice be confident that it was still working because it was the same internals um yeah move as close as you could to 2.0 yeah um and that was there were a few big changes not very much changed in terms of the api there got rid of a few rough corners uh the big deal was moving from tick precision which the same thing time has uh to 100 nanoseconds yeah from 100 nanoseconds to one nanosecond so one nanosecond uh which just felt less kind of window-centric and yes it so happened that at the time i was part of the team designing bits of protocol buffers version three including some of the standard types including timestamp and they had nanosecond precision i thought yeah let's just align here this feels like yeah yeah for the future right so okay so what so what is it about note of time that makes it different from the date time classes right people or strokes i guess that people like why does nota time need to exist basically right um and the answer is in the same way that um how many numeric types do we have in net i don't know i haven't counted recently let's ignore bite and spike you've got short and you short into new int long you long float double decimal uh big integers big integer yeah right um and we we're kind of used to that because it's useful to know that something's an integer you don't we would feel odd if someone tried to add half to an integer we would want that to show up as being wrong yeah yeah um and can you imagine a language only having a single numeric type javascript which may well be wrong by now but you know uh it always struck me as kind of weird and certainly you wouldn't fly for a statically type language because you want to be able to represent that but for some reason we fit we at least thought that it was absolutely fine that there was no such thing as a date um and let's ignore java util date which is just a fantastic example of how not to design an api in many many many ways um but you know date time feels like it's sort of the floating point version we want date which is the sort of equivalent of int and you shouldn't be able to add a minute if you've got a value that logically represents a date i don't want to be able to add one minute to it right because that's yes it's the wrong domain yeah so at this point specifically about what you're what you're saying we should probably stop and mention that.net six does actually have improvements in this on this right and it does it has date only and time only right so for for people by the way watching we included a link to the blog post and dotnets for the dot next blog post that basically talks about all this stuff we we have these these two new types yeah john you are about to say stuff about yeah so um they're fantastic um a great addition um i would like to uh selfishly or vaingloriously or whatever uh think that maybe if known a time hadn't happened then daytona time only wouldn't have happened i don't know uh right i'm sure there was an influence there well let me have my moment even if you think i'm wrong so basically you can now for the first time in history and net actually this talk about a date in an unambiguous way right and a time a time in terms of like 12 o'clock or 1 o'clock without a date in an ambiguous in an unambiguous way no way to get confused whereas before you had to stick it in a daytime and then there's the other part which you don't care about and you know what happens with that right exactly or you take it as a for the time part you say oh i'll just use a time span and so you have datetime.time of day is represented as a time span you think well a time span is a a period of time or yeah a length of time a duration as as notice time would call it um and you say well okay that's that's the the amount of time that's elapsed since midnight right well unless it was last sunday in the uk yes um when dst kicked back um and actually i i enjoyed uh the clocks going back more this year than i have ever done before it's always nice in terms of sleep but this year i had an extra financial benefit um i have an electric vehicle now and i charge between half past midnight and half past four in the morning because i'm on an energy tariff that makes that ludicrously cheap electricity and this sunday half past midnight until half past four in the morning was five hours long yay yeah i wasn't able to charge for longer i have a uh this year's time zone story as well um time change daylight savings because i moved from the us i used to be in redmond and i moved this year to back to the uk and when i did that yes exactly and when i did that i rescheduled a bunch of meetings and as i send out meeting requests to everybody and of course i sent them out using my local time zone and then i couldn't you know my computer on monday or tuesday morning and i look at them and they're all offset wrong with all the meetings that have been set up because the us hasn't changed yet and so now i've got clashes because mine is just in and so i basically had to reschedule them all so now i've scheduled them all on redmond time so it's redmond time is official now that's entirely reasonable particularly if you're uh working with if the meeting is with multiple people or the fewest people to be upset about it as it were yeah this is um this is a magical week for me and we have a magical week back in march or whatever it is uh when i'm only seven hours out from the west coast exactly yeah it means i get my evening uh starts earlier which is exactly yes um it's a lovely thing so i mentioned in terms of why no time exists part of it was i'm a firm excuse me firm believer that um when it comes to dating time types having more types makes some sense um i'll just spout off some of the types in noda time so we start off with an instant which is an instant in time without respect to any particular calendar system um or time zone so effectively like a timestamp or what a timestamp should be you know the the purest form of timestamp um you don't even get to know what the internal representation is it happens to actually be a duration since uh the unix epoch but we hide that as best we can um and the second anywhere in the universe it's the same right yeah all right we don't do we don't talk about relativity and things yes um but yeah logically yeah um uh we also don't handle leap seconds which i might yeah we'll see if we have time to get onto that right so then there's duration which is also a non it's a machine based concept as it were it's it's an elapsed amount of time with no with nothing cultural about it so i said that an instant was a duration since the unix epoch um a duration could be five seconds five nanoseconds an hour is still it's a kind of humanish concept but it's still a very fixed amount of time right um leaving aside leap seconds and things so you've got this this universe of machine time which is primarily instance and durations and you can have an interval that is between a start instant and an end instant so that's all the machine time side then there's the sometimes called civil time um i first heard the term civil time later than i wrote no time so it's sort of too late to name things that way um but we have local date which is what you and i would call a date um it's local in that it is not fixed with respect to any particular date in the daytime zone um there has been a lot of discussion everywhere that needs a local or what i call local concept as to what you should call it um and civil would have been a great name but local gives entirely the wrong impression to some people and the rights right it's a very overloaded term i mean in data in the daytime context when you say local it means local to the time zone configured on my machine right right yes very different exactly yes um and similarly like encoding dot default uh is not the default encoding for things like stream reader and stuff it's it's system default exactly yeah yeah yeah that's a problem um i part of the reason for choosing local here was that was in line with joda time and java.time took local as well and so there's a large proportion of date time apis that do use local right um and once you once you know what it means it's it's consistent everywhere right so you have a date you also have time of day or local sorry local time um which is a time of day and you put them together and you can get a local date time and unlike um so that sounds a little bit like nets date time type um with two big differences firstly is there's no such thing as datetime.kind in notified which is the biggest the biggest abomination in the net api bcl like right um although i will i will say it's there for a reason uh it wasn't there in 1.0 i think it was introduced in 1.1 and it so happened that uh when i started working on the protobuf timestamp and date etc uh representation i worked with a guy called anthony moore um very nice guy and uh said right here are my sort of credentials or hit read this blog post that you've linked to about what's wrong with them date time anyway to sort of see where i'm coming from in terms of date and time philosophy because that will affect my feelings on designing this protobuf and anthony said oh yeah i know that i maintained system.date time for the last five years i think it might have been yeah it's you know responsible at the time for datetime.com so just to give just to give our viewers context not everybody is maybe aware of this if you use a daytime there's actually three kinds of day times right daytime has a property called kind and there's an enum there and a daytime can be either local or utc or unspecified and without even going into what these actually mean the fact that you have three very different types of things represented via some property is horrible is absolutely awful so you can take a utc daytime which is something that is supposed to which represents an actual utc timestamp we know when it happened we know exactly what it is it's unambiguous and you can compare that with something that's a local timestamp and if you go in and you know and see the the the blog post that we link to in the show we don't even know what that means what does it mean to compare these two things right these are two completely different things in in terms of you know logic right it makes no sense to compare them if you're doing it you're probably doing it wrong and you have a bug in your program right and what i absolutely love about noda time now i'm gonna now i'm gonna talk a bit but what i absolutely love about node time is that it takes these very different logical um ideas or concepts and it represents them via different dot net types so you can't an instant let's say is roughly something that resembles a utc times time stamp right it's like an actual moment in the universe like maybe a utc times time you know daytime and it takes a local daytime which is something completely different that doesn't represent that which is an arbitrary you know a date and a time together we don't know where they are and you cannot compare these two things you cannot get this wrong the type system forces it to you know forces you to program correctly i think it's a wonderful example of how good api design can uh kind of guide programmers guide developers in the right direction thank you good exactly i had to do that sorry why then not just use utc everywhere if uh you know so i will come back to that okay we'll come back to that yes i will definitely let's defer that for one second um but um so to pick up on daytime.kind uh there are actually four kinds but one of them is kind of hidden because i've seen it in the bug yeah yeah so um you know it's uh this is represented using two bits within the um within date time and uh it's kind of handy that there are four because if you convert to a local time and back uh from utc to local time and back um that that can only be unambiguous if it knows what happened uh in a fallback position so for example last sunday in the uk um the time 1 30 in the morning happened twice yes so suppose you take the date time good job humanity good job at date time with the kind of utc and call to local time it needs to uh um and it was the first occurrence of um uh one thursday morning um so local time then would have been uh 1 30 hang on so 130 utc yeah um see if john's getting confused here that shows you time time zones are really hard yeah really hard so it was it was 12 30 in the uk i'm sorry 12 30 utc was the first time that we hit 1 30 in the morning because that was while we were still in british summer time and then later when we got to two o'clock we went back to one o'clock local time so 1 30 utc is the second time that it was 1 30 local time so if you take that 12 30 utc call to local time to utc door to universal time that does get back to 12 30. if you call if you start with 1 30 utc and call to local time to universal time that gets you back to 1 30 utc how is that possible because the two local times that that were halfway there you know the the intermediate step are not exactly the same value they've got this hidden difference in the representation one is kind and it's the second one versus kinda local and it's the first one but i think that that raises a very good point because if you just start from a local time uh if you basically just take a local time and you say please um convert this to universal uh to universal time the result is going to be ambiguous in certain situations right yes that is exactly exactly the kind of stuff that is wrong with the bcl kind with the bcl types that nodatime forces you to think about once again and forces you to kind of handle correctly i i've written your script what you are hearing is basically again one just one one small thing what you are hearing here is basically years of pain uh dealing with with uh timestamps and time zones any programmer who has not gone through this and who has not had to deal with that kind of stuff thinks it's simple and doesn't understand the big deal and oh why should i use noda time right this is this stuff is all simple if you think this is simple you simply have not actually had to do it correctly uh really and this is why i know this stuff also is because i've gone through that pain that's it i'm done right so the philosophy is precisely that i want to make people think and that's why people get turned off from node time because working with node of time is harder than working with date time um if you don't mind ending up with buggy code it's easier than working with system.datetime if you're really keen on getting the correct code and not just the correct code but the correct tests and specification because the more you have to think about things and i've had this with product managers in the past you've said oh this is really simple yeah it should behave this way and it's like okay if you think it's simple what should happen in this case and this case and they say oh well it should do this and it should do that well those are incompatible with each other you've just proved it's not as simple as you think and basically just like it's a simple thing right like people think there's 24 hours in a day but when you've got the daylight saving there isn't like i wrote software that ran on trucks a long time ago you know drivers would log their times and everything and you know it's like there's 24 hours a day no there isn't like when daylight says like there's 25 hours in that day and there's 23 hours in that day like it's not simple at all we push people uh in a few ways so one is the type system as i mentioned you know if you give lots of types you force people to what kind of value are you trying to represent um and you could go overboard with that and sort of say oh well it's it's always in the morning so let's have a type a type system that stops you from representing things in the afternoon right but that's not that yeah that's not necessarily relevant but yes right it's it's the genuine type of value rather than the domain of valid values within that right um and as well as the type system there's defaulting we basically don't default anything uh beyond we reckon that almost everyone will use the iso calendar system which is the gregorian canon system and this is um very very largely the same um one of the big differences with the bcl is you have date time you can construct a date time with a different calendar system but it forgets about it it's a it's a conversion thing i do wish it weren't part of the constructor if it had been a method you're just on the calendar calendar dot create date time here's the year month day and it gives you uh a date time that it's your month day will be completely different um and that's that's fine there are places in the world that use julian calendar still i believe right uh possibly julian there are lots of places yeah japan uses the japanese calendar obviously um israel uses the hebrew calendar sometimes like for some purposes and the hebrew system is an interesting one as well i hear i hear interesting and i'm i'm understanding something quite different but which is which i completely believe but yes go ahead you know two different ways of numbering months there's a scriptural way of doing it and the civil way of doing it and you don't have a leap day you have a whole leak them up but it's all oh it's so weak once yes yes yeah anyway yes calendars are very hard and complicated i'm just going to try to move us forward because we're yeah that's all i'm saying calendars are complex for a long time we do default to the iso calendar system if you do new local date year month day it will implicitly do the same as if you do year month new local date year month day calendar system you'll say so um and i'm okay with that however you can't say give me a new zone date time which is one that's in a time zone and say year month day hour minute second and it just used the system local time zone no anything that uses the system local time zone you're gonna tell me that you want it um there is one very very slight difference where i don't no it's not even with time zone it's with the clock um that's the other thing we've got datetime.now and datetime.utc now and anytime you use those you are writing code that is really hard to test um so we we think for in no time the clock is a dependency you should inject it in the same way that you depend uh yes any other dependency um and you don't need to be using note of time to do this and this is my biggest tip to non-node-a-time users are create an i-clock interface with a single method interesting yeah um and then you can have a singleton and you know normally singleton pattern eek but it's reasonable to have system clocked instance because there really is only one of them yes if you happen to have a machine with two different system clocks in then you could create your own you know clock system but otherwise i think a single things like that and that by the way is very useful when you're writing tests and you want to control your clock and uh you want to mine basically your clock right so that that's a place where things become very useful but yeah which is another pattern that we've got in the loader time package so we've got loader time is the main package and nodetime.testing is a package that i always release at the same time and that has a fake clock and guess what you tell the tape clock what time you want it to report and if you want to write code that says you know arthur your truck um behaves correctly in a time zone uh that has daylight saving time and with you know on the day that the daylight same time um happen then you can you don't even need to leave a real time zone you can create a sort of fake time zone that you know when it has dst transitions um or realistically i tend to use something i put my tests in the past so they can't be changed by any date time zone changes coming up but uh i'll use a real time zone and sort of write a comment saying in the uk it you know the the clock changed back from two o'clock to one o'clock on october 31st 2001 excellent um but you but you can create your own date time zone if you want to have very specific things and you can use this fake clock and you pass the fake clock into your code and hold your tests work you know wherever you are whenever you are it's irrelevant um so yeah we don't like defaulting things we want to force you to use as far as possible we also the the other thing that's slightly unusual in the dot net world is we have the idea of a pattern which is a way of formatting and parsing text so um we do what the the bcl ways of sort of get stuff from the copy um you know give me my cultural way of formatting dates and that's fine um but you can also whenever you've got a machine readable date so yes and top tip when you are formatting a date work out whether it's for a user or a machine format yes machine always use iso 8601 or some variant of it and then use something else um so we have a pattern that you can set up with the the format string inside it you know of yyyy mmdd or whatever it is um and then you use that to parse all format and uh you you when you pass you get a pass result of local data or whatever and you can say is it successful or not and access the value if you try to access the value and it wasn't successful it fails so it's a little bit like tripars but it gives you i find it a better pattern than than trying because if triparz fails you don't know why it's failed whereas if a pars result has failed you can say well i'll just try to fetch without your fetch the exception property and it can tell you why it failed without you having to throw the exception yes right right okay i've probably brain dumped enough probably okay we want to get back to utc at some point yeah maybe let me do a quick recap and then yes let's move back to utc everywhere yes no when uh so just as a recap basically know the time is um um a rep we can look at it as a replacement of the built-in bcl uh daytime uh types and related kind of stuff that are architected in a way to make you program correctly and forces you basically to take into account very important things like time zones and conversions between them i'm a big believer in this um maybe we'll show a little bit of code later just to show people what what this looks like but i really want us we have about 20 minutes and we also need to do a bit of database let's talk just a little bit about this whole utc stuff that everybody's been talking about there's been a lot of questions here i see and you know in the question feed so a lot of times people kind of say okay so what's the problem let's get rid of the whole complexity with time zones and local kind of stuff let's just do utc everywhere in the database in my program let's just do this what is this all about basically is it a good idea it can be um for for values in the past it can simplify things significantly for values in the future it becomes trickier um in particular for timestamps it's it's always a good idea um representing timestamps as a local time uh just leads to weird logs and hard to read stuff and ambiguity and badness right so to give an example of what john just said because we're a little bit in a database kind of environment there's this question of okay i'm going to send i'm going to store a timestamp in the database that's like the most basic thing you're going to do in life right what what should i store there right um and the answer in that particular case uh when something happened when a specific database rule for example was inserted in that kind of case i think john would also agree it's a fairly best practice to always use utc in that kind of situation otherwise if what you're doing is you're storing let's say a german time kind of uh time step in there then first of all you need to be careful about people viewing it when you take it out which time zone do people actually want to see it in and you're going to have to convert it back and forth plus there's all those very beautiful uh you know problems which we just talked about with daylight savings right if i'm if i say that something happened at 1am uh you know whatever local german time which 1am is it exactly on that day when things kind of flip around right so utc kind of sidesteps the whole thing there's no daylight savings in utc that's like a major major important point of utc in general it's unambiguous and you can always take it later and convert it of course when you want to display it to some user in a web browser in an application that is when your program should take this utc thing out of your database and convert it using uh you know noda times amazing time zone conversions apis and then send it to the user in the browser is that kind of fair what i just said that is absolutely fair and it sounds like a really compelling argument to i you know i'll pass uh whatever a user's given me and convert to utc use utc throughout as much of my code as i can including at the database and then again at the last bit i'll convert it to a human readable form and that is fine when the value that you're trying to represent doesn't have a time zone inherently attached to it unfortunately in the real world it often does so and the even that would be kind of okay if uh time zones were fixed and i don't mean fixed as in didn't observe daylight saving time or whatever but if we knew the rules for the rest of time right yes so this is this is the problem with the past and the future so everybody listen up this is this is where it gets a bit tricky so um i've got a blog post that goes into all of this uh it's linked in the in the yeah in the show or in utc is not a silver bullet so uh the examples that i give there are probably in the past by now but let's suppose um cheyenne and i decided to meet in paris uh on december the 1st in 2022 okay now at the moment we would believe that uh in paris on december the first of 2022 uh paris would be a utc plus one because it will be in wintertime that's our understanding so we say okay we'll meet at nine o'clock in the morning um are you a late riser or an early riser shay i'm more of a laid riser because i have to be in meetings like at 10 p.m with people anyway we'll say we'll have brunch at 11 a.m much better on december 1st 2022 so okay our potential system says great that's fine uh that's 10 a.m utc on december 1st 2022 that's what i'll store in the database and you put it in the database and you leave it okay so you you've done a conversion i'm just going to sum that up you've you this hypothetical system basically took this this time and it converted it into utc now today okay it did it now and what we're storing in the database is the utc time span timestamp that corresponds to our meeting time as of today as of today and just to be clear it's not that we're being stupid and saying oh yeah we'll take whatever the current utc offset is in paris what do we believe the utc offset in paris will be first we've done a proper time zone conversion based on today's rules yes um unfortunately next march the french government says right well we're going to abandon daylight saving time we're going on to permanent summer time so from now on or you know from september the first onwards um paris will be in utc plus two so shaun and i have a look at our calendars and uh suddenly you know we still have a good code that is going to convert our utc into the local time and it knows about these changes in the rules um so and how we get those is an entirely different story and so it says yeah okay you had 10 am utc on december 1 2022 right that's 12 o'clock so we then show up at midday except i don't because i'm a luddite i've written it in my um in my notebook in my diary as i'm going to meet at 11 o'clock so we don't end up because that's what we told each other right exactly and the problem with all of this is when you do the utc conversion um even if you say and i know that it's in paris so you've kept the time zone you have lost the information that the user gave you and my sort of golden rule is if you capture everything that the user gave you you can't go wrong because whatever else you've done you've got that golden source of information you may not have asked enough information so if the french government had decided okay well we're going to change so that um the time in paris will go back an hour at half past 11 00 in the morning on december the first then suddenly 11 o'clock becomes ambiguous when it wasn't before so yeah right there there are corner cases within the corner case but we have captured we could have captured everything that the user told us and if we store that then even if we tape and it can be a good idea to keep another database column for i have done the utc conversion from what the user told me to utc because then you can order all the events you know unambiguously for example um that's all handy but you can regard that as temporary data and if you get uh if you derived or changed you can then just say i'm going to recompute that that's fine yes um if you may need to also have something in the database saying uh the utc time was last computed with this version of the time zone data depending on you know how that's going a bit far but yeah well it may or may not be depends whether you should convert the whole database in one go um but that's the problem that you've lost information and that's generally seen as a bad thing right so again i'll i'll do a quick very quick summary here in general if we're going to represent uh you know stuff that happened in the past because uh you know um the whole time zone thing the the time zones don't change in the past right the these rules which we just discussed are basically fixed for the past they don't change which is why it is also safe no oh john has john has a bad expression on his face now the reason it might not be safe is um even if the rules don't change retroactively your system may not be not may not have been up to date with the rules right so sometimes governments change rules with only a few of these that's a good point that's a good point okay again it's it's really corner casey but if you're if you're using uh you know john skates note a time and you're upgrading um you know consistently consistently and you know uh on time then you're probably okay so basically if we're talking about the past utc as a safer option in general because we're just talking about a point in time and we it doesn't it doesn't even necessarily matter uh you know in which time zone this thing happened right what we want to know in general when we're talking about timestamps and computers is when this happened on the global time scale any any other information is kind of irrelevant so in that specific scenario yes definitely utc everywhere but when we're talking about a future event that's going to happen in human time or in civil time or whatever you want to call it then you have to really really kind of be careful about this now i want to segue into into something very important here if you want to represent this whole in this this this entire piece of information which john just said which is when this is going to happen and also in which time zone then if you're using the bcl if you're in.net you're kind of out of luck right how are you going to represent this so a a day time is going to you know is going to you know represent like the date and the time but then you also have to have a supplementary kind of thing to represent the time zone in which this thing uh is going to happen right our meeting so you already have to have two things in.net there's no single thing in.net that's going to combine those two things which you can then pass around right which is how we want to do things whereas know the time in contrast has something else date time which has uh the it represents it as a local date and time and a time zone and an offset just in case it's ambiguous um right but importantly actually for efficiency purposes you might think ah that could be just the the zoned date sorry the the time zone and the utc and you can convert whenever you want um we've actually found that uh we can make things more efficient by if we're representing something local remember those local things don't even remember sort of nanoseconds since 1970 ignoring time zones we actually have different different sets of bits for year month and day because then it's absolutely trivial to um to extract those so if you if you compare localdatetime.year month day with datetime.year month day we absolutely that's an interesting point i wasn't aware of even there's even a proof argument for doing things this way which is which is really really like yeah that's that's pretty cool i didn't even find it kind of counterintuitive because it wastes space it is yeah and it also uh you have to design it carefully i nearly went to notre time 2.0 with the wrong set of bits because i wasn't aware of the wondrous or baha'i calendar that has 19 months so i had foolishly allocated only oh dear this is the person who knows all about every single exotic trivia around um times and time zones so um so we've used up quite a bit of time it's a great discussion how about we uh we do two things we look at some code and also maybe shy we see about uh using it with af core and databases at the same time agreed should i should i kind of uh present a little bit like a couple of minutes let's see so around code we kind of uh um okay i'm gonna do just a very quick demo of like some insane behavior in my opinion in uh in daytime just to give you guys an idea so um you guys may know let's let's maybe go up here let's take a look at this simple code right here okay so what we're doing is we're taking two time stamps we're taking two like of now we're taking uh you know now and then we're gonna sleep for a bit and then we're gonna take another now obviously the other now is a bit different from this now right but this this example is important for me and then we're gonna ask is the second now bigger than the first now now uh you know when you take now later than like a second now later than the first now then it's you know it's to be expected that the later now is going to be uh you know later than the first now right however if i run this thing um of course if i'm running it then we're going to get false and the reason for this this is again i'm just trying to show people why they how daytime is very very tricky and leads you down it you know in a very reliable way you're gonna get it wrong with daytime if now i'm gonna print out what these two nows are then you're kind of gonna get the idea of why this happened what you see here if you're seeing my screen is that the first now has a kind that is called local and the other one has a kind called utc so we mentioned this before this is because this property returns a local date time in my machines time zone whereas this one returns a utc datum right and the times are different okay because this one is a local one and this one is a utc one and when you compare this you can see that the the second one it was taken later but it's actually earlier if you just look at the hour here because 18 is bigger than 17 but is this really same behavior uh like when i'm comparing things maybe it's saying maybe it's not what i would really like is for this thing to not compile this is i think the main the main um you know lesson that we try to talk about here right it makes no sense to actually compare these two things because they represent very very different things uh i'm going to jump another another since we're talking about the uh the date time kind um another thing that makes it even harder once you once you're using your database and i'm going to pick on sql server here um uh postgres has its own uh date time issues too as shy knows very well from his recent release but picking on conservatives when you use sql clients so this isn't even an ef thing and you save a date time to the database and then you read that back just through sql clientnormalado.net it completely loses what that date time kind is so you can save a local and then bring it back it'll be unspecified you save a utc and bring it back it'll be unspecified so once you start actually trying to serialize these things or save them to and from the database it gets even worse because you totally lose that information that's a great even more confusing that's a great point and the the fact of the matter is that sql server the the date time type like in the database doesn't have a kind right it just has it's just a day time what no time calls a local daytime right so you can't it isn't fully round trippable in that sense and they said you're going to get the same thing possibly if you're serialized to json i'm guessing or to any other thing right the kind is actually a fundamental piece of information about this thing which usually doesn't get saved or or serialized right and that's a very big problem in in the world in general i just wanted to show people like a little bit because we've been talking so much what uh noda time code actually looks like so let's take a look at this this is i think a reasonable example i hope john will agree so this is just an example of these three of the types that john mentioned first of all we have the thing called instant so instant once again is simply an instant on the global timeline you could think about it a little bit like a utc timestamp but it really kind of isn't it's more logically you know just an instant you know that anybody everybody can agrees on why am i saying it's not a utc timestamp because for example you cannot go to this thing and ask it what hour are you in if this were a utc timestamp then you could right because in utc it does have a certain hour uh or whatever but this isn't that this is just a globally agreed upon like objective whatever you want something on the timeline exactly now if you want to start to actually reason about hours and days and you know these human concepts there so this again this is the ideal thing to use when you're just you just want a time stamp you want to know when something happened like uh i just received the packet i wanna you know do a timestamp this is what you want you just want an instant for when that happened now if we want to start talking about in which day this occurred things become a bit more complicated because we have to say wait which day in which time zone obviously right because it doesn't mean anything days are different in different time zones so what we do here we take this instant and we're going to convert it into a zoned date time okay we're going to use a method called in zone and we're going to tell it what i want is to convert this instant into a zone daytime in berlin so assuming i'm in berlin which point so this point in time objectively speaking what does it correspond to and we're going to get back something called a zoned daytime amazon unambiguous conversion exactly you don't have to specify anything apart from the time zone everything else is known exactly this zoned time already does have hours and minutes and seconds so you can already go to it and say which hour did this happen because we already know we're talking about berlin see how we pack so no the time or john more specifically pack together all this information into a single clr type that is vital it's extremely important there's the actual global moment in time that's in there but there's also berlin that's inside there and once again there's no single bcl type that's going to do this for you that's that's very important now finally if if if you want to if you want this is not something you necessarily want to do but you can take that zone daytime and you can extract a local daytime out of it so basically you're saying okay forget the fact that this is in berlin what i want is now something that's more like you know a date and a time and i'm gonna forget you know that context so this loses information and it gets me back something called a local daytime i can take this thing and convert it to another zone zone daytime if i want to if i wanted to do that i could do that i could also do that directly on zone zone daytime but what people usually have in their hands when they have a daytime in.net and unspecified date time is something akin to this this is why i wanted to show this type local daytime if you have uh sql server daytime what arthur just mentioned what you have inside sql server is basically this thing it's a date and a time and we know nothing about them we don't know where they are we don't know if they're utc or maybe something local or whatever we have no idea if i run this code just to show you then the instant when we do a tostring on it is actually a utc timestamp okay that's a reasonable way to actually show an instant although once again an instant is not exactly a utc timestamp it's a concept always important to keep that in mind right then the zone daytime you can see has all the information that we just said it had it has the local daytime now this is not the same time right here we have 17 and here we have 18 as the hour this is because this is the local daytime in berlin and we have the time zone in there and we have the offset in there we have all the information and finally when we convert this into a local daytime which is sometimes what we're going to do when we send something to the database i'm kind of leading to the database part of it then we got rid of all this extra information and all we have left is 659 okay so let me um let me uh inject a question here that i i think comes up quite often uh maybe you'll come to this later or maybe it's too much of a rabbit hole to go down date time versus date time offset okay i'm going to use this to jump because we're also going to go a bit over time we're going to take yeah that's fine over time so that's the right moment i think to jump into the database side of things so right the tricky part here is that there's the whole.net side of things with you know nodatime bcl that's one domain and when we're talking about a database that's a different domain and each database has its own you know set of daytime types and the job of uh something like ef or a database driver is to map between these two things so if this whole insane subject weren't already complicated enough now we have to map between two different systems which don't really map they don't they absolutely do not um so i'll briefly mention two databases here sql server has two types it actually has more but i'm going to concentrate on two types there's something called datetime2 which is a timestamp so a date and a time it's it has no specific it's not support necessarily in utc it's not necessarily local it's not necessarily anything it's unspecified okay you can you can you can systematically populate it with utc timestamps and that's what you're going to do if what you want to do is utc everywhere that would be the best practice in that particular scenario as we talked about before okay but there's nothing about that type that says i'm a utc timestamp or i'm something else so that's an important thing there's also an audio in your field name if you're going to systematically populate it that's great advice you could like kind of self-document the utcness of that field by putting it in the name that's actually a thing in fact we had that very discussion we did temporal table support in uh in ef course six zero and in the api review we looked at all of the you know time stamps things and we said we're gonna say explicitly in the names these are utc because they're utc so let's just be very very clear right yes so if what you want to do is to just represent a utc time timestamp then i think the best practice here is to use daytime too not daytime offset by the way and say name it appropriately so it's clear and just you know save things into that daytime offset is in sql server is pretty much the same thing as what it is in.net and that's a type which i honestly don't believe is extremely useful like my my gripe and that's another subject that we talked about uh that you know we should have talked about a little bit more we were kind of out of time an offset is not a time zone um folks okay that's a very very very important kind of thing so people kind of think i'm using daytime offset i've thought about time zones yay hooray i'm gonna pat myself on the back right i'm i'm a mature aware time zone aware developer and i've solved the problem well so the thing with daytime offset it gives you the illusion of you know having treated the problem whereas you actually have not as we as we said okay if you're in berlin today i might be an offset plus one but tomorrow i might be an offset plus two right daytime the whole point of daytime savings daylight savings time or whatever it's called is that the same time zone is going to be in different offsets in different you know uh periods of the year point to it sorry two daytime offset no today you said the whole point to uh daylight saving i was like that's a human thing i don't mess with human things i'm just a programmer i'm a computer person the real question here is there is there a point to daytime offset uh because once again if what you want to do so again if if you're saving basically if you're treating if you have a daytime offset in your hands you can always convert it to utc right i mean you can you can just apply the offset you get back a utc timestamp time um timestamp it daytime offset is not actually timezone aware it isn't because it's lacking the whole daylight savings kind of stuff so you can't use it to actually uh you know do do things correctly you can't add an hour to it because you don't know what you know the out the next hour is going to be that's going to depend whether you're in berlin or maybe in france rules are going to be a bit different right so in practice and here i actually am interested in what john has to say about this i'm not sure when daytime offset is actually a useful thing john uh so i would say that date time offset means that the type system uh will force you to have something that you can always get back to utc even if you have date time offsets with the always have an offset of zero um i find it a useful way if i'm trying to represent something that is a timestamp in the bcl i would usually use time offset because it does unambiguously represent an instance in time although you could use daytime with kind utc right but then uh the compiler won't tell me if i'm doing something wrong with it right where is if you save it to and from the database as well absolutely but then but then my question would be if you are using um noda time and notation does have something called an offset date time which is a daytime and an offset when would you use that then uh so um partly when you are dealing with systems that have decided to represent something okay a local date time and an offset which is really really common um yes we hardly ever in in data transfer you hardly ever see something that has a full an actual time zone yeah yeah partly because the time zone ids you know someone mentioned how do we get the information from governments um the the iana time zone database maintainers and sort of watches of which i am one um sort of say well okay please email us if you have uh something from a government in english that said this this act of parliament or whatever was ratified and we kind of rely on volunteers and and they sort of watch out for news articles and things but it's not nearly as comprehensive and really well thought through as you might expect well one day british one day british parliament will be like directly integrated with you know ayanna oh some time zones right and parliament decisions of parliament will will just go out as uh as a computerized update to that and it happens i contribute to um there was a house of lords uh review of should uh the uk change its time zone to not observe daylight saving time either go to permanent gmt or permanent bst um which we've previously been in a two-year experiment for permanent bst where that was british standard time which ironically uh overlapped the unix epoch so if people say a bit of trivia if people say the unix epoch is when it was midnight in greenwich no it wasn't it was one o'clock in the morning i'm gonna stop you right there i'm gonna stop you right there i gotta actually i'm just aggressive i don't wanna hear this stuff this this makes my brain hurt i don't wanna hear it i don't know so so we do rarely see uh right but the one thing that a daytime offset does tell you all right it tells you two things at the same time the local time for presumably who of whoever was observing something and an unambiguous instance in time right in a compact format yes so i kind of like it in that sense but you're right it doesn't tell you what the local time would be a second later exactly exactly and that's important so so people should should keep this this definitely in mind now again since time is short i'm again going to jump back to the database side of things what i absolutely want to show here is also the fact that ef core integrates with node.time in a very very comprehensive way that's a very important thing so what i'm going to show i'm going to switch here let's see one second i'm going to exit presentation mode and i'm going to go and run this thing here which is a different thing i will just mention that the ef core integration is nothing to do with me um yes i know very little about databases well actually community people exactly yes did all this stuff yes so shy we lost your screen though so you'll have to share again oh let me do that very quickly sorry that's that's like um are you on linux or something sorry not not at all very funny very funny are we is my screen on again uh yes it is there we go okay good so yes uh basically what what we have in ef core is a set of plugins um so efcor has this extensibility kind of model when you're using for example the postgres provider there's another nuget package which you um you know insert in and it's just magically going to support node time mapping to a database i'm the one who wrote the postgres one but there's two other community ones for sql server and sqlite the links are in the you know the link list for the for this show so absolutely if what you want to do if you're considering using know the time but you have to interact with databases you should know that you're covered at least to some extent okay i can't exactly speak to the comprehensiveness of the of the sql server and the sql lite um you know packages at least on purpose postgres you're definitely very very much covered so i'm going to do a very very quick demo um what you have here is a very minimal kind of ef core model we've got a blog context we've got a blog and we have a creation daytime property if i run this and once again keep in mind that we are on postgres so you're going to see some scary postgres stuff we're creating a table blogs and what you see here this is our thing is something called so the it's called creation and this is a time stamp with time zone type and postgres very confusingly this follows this the sql standard this does not actually contain a time zone what this actually means is utc timestamp so postgres has two types one of them is a utc times timestamp and the other one is a local timestamp a timestamp where we have no idea what it is this is the basically the postgres kind of system if what we want to do now is to switch to using um noda time then all i have to do i've already referenced the package i'm going to add this little thingy here so when i'm doing use mpg sql i'm gonna tell it to use the node-a-time plugin this extensibility and at this point what i can do is i can go and say just change the type to instant and if i do if i run this thing then i'm gonna get hopefully exactly the same thing right because an instant represents um a utc times timestamp right if on the other hand i go and do this i didn't have time to test this properly so i hope this is demo time this is obviously going to fail in some horrible way or maybe not if i do local daytime then this is going to be mapped to a timestamp without timezone because we have no idea what it is so this represents something you know unknown i'm even going to like i'm going to do something very very cool just so i can show off a little bit um noda time also has something called a date interval for example so um let's call it let's add this property here a date interval is simply a start and an end date so here we're we're talking about a date this is not a timestamp it's an actual date if i do this specific thing then the postgraduate provider is going to map this to something called a date range in postgres so this is a native postgres i'm shamelessly plugging for posters here because postgres is an awesome database there's a native type in here which corresponds exactly to this idea of a date interval once again you won't find this in the bcl you don't have this concept in the bcl and you don't just map it you can even go and say give me back all the blogs from the database where um let's jump around a little bit where the blogs create sorry what we want to do is look at the date interval exactly contains in here i'm going to instantiate another time date i'm going to explain this in a second this is a query that i just wrote in link i'm selecting out of the database out of postgres all the blogs whose date interval contains january 1st 2010 and if i run this thing what you see here is that the provider or rather the plugin can actually translate this thing into this query here so this thing which is of a type you know date like a date range in postgres also has an operator for containment and we can actually test if this thing contains that thing so what i'm trying to say is that we we basically have got you covered in terms of noda time maybe a bit more so on the postgres side because also has various features which sql server does not um i'm extremely interested in you know people trying to use noda time when they're interacting with their database because everything about it is simply better if really and i say this like wholeheartedly i'm not even trying to uh you know i'm not trying to suck up to anybody here it's simply a better way to work with daytimes in general uh if anything is lacking in terms of database supported ef core then that's something i would be interested in knowing about and we you know we'd like to make that you know go forward so i'm horribly obliged to to try to write a plugin for uh spanner the the recently released yeah you are definitely morally obliged um yeah and and that should that should fit in really well actually because you know hey spanner uses the timestamp proto that i helped design there you go there you go you can and you can even maybe like preserve the nanosecond precision which you know most databases can't right yeah absolutely most databases are microsecond or t or ticks exactly so let me go back and just uh recap a few things that shy went over there that to just explicitly uh state this because there's some been a few questions in the chat around this so shall you showing the use npg sql um for using uh use noted time and npg sql for postgres there's also use node time similar uh extension method that does it for sql server and one for sql like so those all exist um i'm sure it will be possible for somebody to put one onto the to work with the pomelo mysql provider so if someone wants to do that that's a great community project um and then i also wanted to point out because there was some questions earlier on in the stream about the integration with the f core so if you go back and show your entity type again um shai um which had to have the uh the noted time types in it so you notice here that we haven't set up any value converters we haven't had to do anything special uh the way these plugins work is they explicitly add to the type mapping of the system so that these are automatically picked up it's not like you you you now have to write your own code that convert back and forth from these things that's what that's what the plugin system does and that's what kind of makes it a really nice experience where it just kind of feels very natural so if we were to add noda time support directly to ef core it wouldn't be any better than this this would be the same thing you know and that's the whole idea with ef core having this the provider and plugging a sensibility that these things can be plugged in the same way and then if you go back to where you were the same thing is true of the link query there um again you're just writing a link query in the same way as you would if it was a first class part of ef course so really you know this is this is a great example of where having the extensibility allows people to do these kinds of plug-ins for different providers do the mapping you know hook into all of the type mapping and everything which is obviously a much more scalable thing than if we tried to just put everything into ef core but it doesn't mean in this case you're not getting a very first class experience with these things so um again to shy's point you know don't don't feel hesitant about going and using nodatime is it's not like you're gonna get suddenly a worse experience in any way than if you were using you know the daytime stuff so right why to cover those things and then there was a question about because you showed the various things but somebody said what happens if you use a zoned date time um in the what does that map to that's a great question so what should it map to a zone daytime uh so again in postgres at zone time a zone daytime cannot uh actually be round tripped because there is no date there is i've never seen a database which has a single type that has a timestamp in a specific time zone that does not exist as far as i'm as far as i'm aware just like it does not exist in the bcl now the principle at least in the new version of npg sql is that we never allow you to save something that cannot be round-tripped because that's a source of a lot of issues like what arthur was saying with the kind right we don't want people to uh you know to allow people to save uh something like that and then they lose the you know the time zone so in the new version that's coming out next week in fact we allow you to map zone daytime to a timestamp with timezone so to a utc timestamp but we only allow you to write that value if the if the time zone is actually utc so we're going to allow you to actually save zone daytime only in the specific case where it's a where it happens to be a utc timestamp anything else is gonna um is gonna throw and then that's a very that i was just about to lead into this thanks arthur for uh saying this what we want to be able to do possibly uh in in uh of course seven this is like definitely a thing that we wanna think about is to give you guys a way to map a zoned daytime to multiple columns so one of the features we have in the plan is to take a single thing on the dot inside and to map it to multiple columns on the database side of things uh this is like a new advanced kind of value converter that you cannot do today but which we hope to enable for for seven and in that case what you could do is take a zone daytime and map it to two columns one would be a local daytime or maybe a utc john mentioned local local okay local sorry well the reason uh three columns local an offset um and for disambiguating um and the time zone id and the reason being unless you have a fourth column which is the time zone uh database version right back to the whole url right versioning of the of the timezone database yeah good good remarks see i i would not have thought about this thing i would have gotten it wrong so yes drop me a line when you go when you go to implement it will chat makes sense so yes we we hope so right now if you want to actually persist persist a zone daytime to the database you have to do this manually yourself you have to manage two columns and write them uh that's just the way it is if or seven hopefully there's a better way i was supposed to do that feature in afro6 but it turns out when you're a manager you do actually have other things to do than write code and so now it's assigned to andre who spends a lot of his time writing code and is much better than me and so we're really i'm really hopeful that it will fit into seven so yes apparently n hibernate has this already so you know yep this is what somebody says so yeah go use that hibernate if that's what works for you we don't care absolutely um okay so i think uh i think we should probably end about now because we're 20 minutes over our scheduled time um and could go on for hours yes yes so uh big thank you john for coming on the show it's been a great absolutely pleasure anytime yes um and uh yeah i have no idea what's coming up in two weeks it might be what's the what's new in the of course six years because there's a very good chance it'll actually be released you know uh by then so um yeah i think that's what's coming in two weeks time um so yeah look forward to seeing you all then and thanks again john and uh and say bye for now oh and one one more thing is that arthur is going to be talking giving uh talk in dot net uh if i'm not mistaken so you can tune in and see him uh show off he of course jeremy and i do that's that's a good thing we should plug that jeremy and i are doing what's new in ef course six that's on the first day um it's around i think 10 30 in the uk so uh whatever time that is in your in your particular neck of the woods and then jeremy also has a graphql uh a df core talk on the second day which is uh going to be using all the uh the the hot chocolate stuff from from chili cream but that wonderful company that we love so um so yes uh uh that that's all coming up in dot com so look out for that and with that we'll say goodbye bye folks bye everyone [Music]
Info
Channel: dotNET
Views: 4,497
Rating: undefined out of 5
Keywords:
Id: ZLJLfImuFqM
Channel Id: undefined
Length: 83min 40sec (5020 seconds)
Published: Wed Nov 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.