|
Slacker007 wrote: Try storing your date times as DATETIME2 in the database, if SQL Server.
Also good to know. More learning.
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Slacker is right in my opinion.
You should always use Datetime2 for new work[^]. It's not just having better compatibility with other databases. But also with DateTime in .Net.
If you change datatype in the db to DateTime2(0), the fractional seconds are automatically stripped, and the problem is solved.
|
|
|
|
|
Marc Clifton wrote: new DateTime(date.Ticks - (date.Ticks % resolution), date.Kind);
Is that is going to work if they work from 12:00 midnight to 8 am when daylight savings time switches?
|
|
|
|
|
Ha, thats easy, you want to store some timestamps.
Ill use DateTime.Now. to string().
gets me 01/02/2018 11:58:00
Ah good.
next day. F***. Person installed on server, and language in american. I dont know which is month and day.
fix: DateTime.Now.toString("DD/MM/YYYY hh:mm:ss")
next day. F***. the time is in 12 hour format and says I only did 1 hour of work yesterday.
fix: DateTime.Now.toString("DD/MM/YYYY HH:mm:ss")
add some uses case tests.
next day. it still works. good.
2 months later. deployed to 100 clients.
next day. All times off by 1 hour (DST). FFS
|
|
|
|
|
jschell wrote: Is that is going to work if they work from 12:00 midnight to 8 am when daylight savings time switches?
Good point. I totally forgot about that. Fixed now. My client should pay you for pointing that out.
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
I once worked for 36 hours straight. Are you telling me that I'm not getting paid for all of it?
|
|
|
|
|
I would assume this is a simple rounding problem. But not where you expect it but in the internals of DateTime. Historically, DateTime is a double and not a "long long". Dates and times are converted to and from that double. One day is 1, half a day 0.5 and so on. And as it goes with the digits after the decimal point you can not represent any small fractions with a limited number length. Imagine a day has about 10e5 seconds or 10e8 ms. Adding the day (I don't remember when the counting starts) with 5 digits you are using 13 out of 15 digits. A millisecond is 1,157407407407e-8 days.
For testing you can write a routine which start at "Now" and adds millisecond after millisecond. Be surprised what you get when you expect a steady increasing value.
See also https://en.wikipedia.org/wiki/System_time
|
|
|
|
|
MS Access won't accept milliseconds, so you have to do ToString() on all dates going into a date-type field
dateOfEntry = DateTime.UtcNow.ToString(); which removes the milliseconds.
|
|
|
|
|
I don't, but perhaps you should hold your end of the bargain and not go sleep when downloading updates.
An update that should've been done in an hour took all morning and a good chunk of my Saturday afternoon. Because it's freakin' Saturday, and I want need to walk away, so the computer repeatedly goes to sleep.
And people wonder why I configure my systems so they never go to sleep...except for this one. But it's about to join that club.
|
|
|
|
|
dandy72 wrote: they never go to sleep
That's usually the first setting I change with the exception of laptop but only when unplugged. At least set it (sleep) for a few hours.
"Go forth into the source" - Neal Morse
|
|
|
|
|
|
That windbreaker is causing a lot of drag.
Latest Article - A Concise Overview of Threads
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
The answer my friend, is blow blow blowing in the wind
|
|
|
|
|
|
|
|
Update: Looks like that's fixed it, for the moment.[^]
It hadn't. So ... I bit the bullet and got a replacement part.
It's the micro USB connector, the PCB that's located on,, the headphone connector and its mounted to, a flexi PCB between them, and a dinky little 22pin, 0.5mm spacing, locking ribbon connector which attaches it to the main board.
All you have to do is open the tablet, disconnect the battery, undo three screws, move the speakers out of the way, undo five more screws, open the latch, remove the connector PCB(s), fit the new one, close the latch, replace the screws, replace the speakers, replace the three screws that hold that, reconnect the battery, and push the back back on.
Tools: tiny phillips screwdriver, tiny flat head screwdriver (for the latch), plastic thing what takes the back off.
Total time: under ten minutes.
Total cost? £3.50 for the bit, £1 for the plastic thing what takes the back off (which is probably not reusable, they are cheap plastic). Screwdrivers I have in abundance.
Full charge from empty in a couple of hours (using my 2A charger).
That'll do, that'll do ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Truth time: how many parts were left over after you put it back together?
Message Signature
(Click to edit ->)
|
|
|
|
|
Just the old bit I replaced.
I learned at a young age that when you dismantle something, you take care to ensure there isn't anything left over with motorcycle engines. The main reminder was the gear change return spring incident where I discovered that going up the gears was fine without it, but you couldn't go back down. And that included neutral, sod it.
I don't like to make the same mistake twice
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Experience: Recognizing a mistake the second time you make it.
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
What bike Paul ?
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
That was my first - a 1970 Honda CD175: Honda CD175 - Wikipedia[^]
After a while, I could tell when it was going to break down - it would get up to 70mph.
Gawd the things I broke on that ... rear sprocket drive bolts (all four of them, trying to do a hill start: that was entertaining), cam chain tensioner, cam end caps, rockers, pistons, bores, and when I dropped a valve pretty much everything! You learn a lot about bikes: fixing them, falling off them, breaking them again ... I think I got taking the engine out, stripping it, and putting it back together down to under two hours at one point.
Then I replaced that with a CB250T, a selection of CB550's, several Norton Commandos, a couple of CB650s*, some more CB550s, before I crossed to V twins with TR1's, XV535's, a few Vigargo 1100s, and then to Guzzis and Ducatis. I think there were a couple of Kwaks and a race tuned Suzuki trail bike in there, but I can't remember the order any more.
* Why? Why more than one? I'd had one and that was punishment enough...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You where doing all right until you got to tarts handbag Virago , I've still got three bikes in the garage that I never ride these days - A VFR 750 ( best bike I ever had ) an MVF4 750 ( worst bike I ever had ) and a 1962 Norton Dominator which is going to be my winter project - any more motorcyclists out there ?
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Actually the Virago 1100 wasn't bad - it had the best seat and handlebar position combo I've ever ridden, you could go hundreds and hundreds of miles in a day and feel fine at the end. And excellent at commuting into the M25 every day. Very good shaft drive, too - no tendency to "climb the pinion wheel" under acceleration. Nice low CoG.
Didn't handle worth a damn, grounded out far too easily, and with the standard tires way overbraked at the front (to the point where an emergency stop locked up the front wheel ahead of the back). A pair of Pirelli Route 66 fixed that. Nice engine if a bit "sewing machine", and the exhausts rotted far too quickly.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Is that the Chuwi Paul ?
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|