Click here to Skip to main content
15,893,814 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Dating Pin
Peter_in_278010-Jul-12 14:13
professionalPeter_in_278010-Jul-12 14:13 
GeneralRe: Dating Pin
V.11-Jul-12 9:14
professionalV.11-Jul-12 9:14 
GeneralRe: Dating Pin
jschell11-Jul-12 8:09
jschell11-Jul-12 8:09 
JokeRe: Dating PinPopular
walterhevedeich10-Jul-12 19:26
professionalwalterhevedeich10-Jul-12 19:26 
GeneralRe: Dating Pin
BobJanova11-Jul-12 4:38
BobJanova11-Jul-12 4:38 
GeneralRe: Dating Pin
Andrei Straut11-Jul-12 6:19
Andrei Straut11-Jul-12 6:19 
GeneralRe: Dating Pin
UNCRushFan15-Jul-12 12:46
UNCRushFan15-Jul-12 12:46 
GeneralRe: Dating Pin
jschell11-Jul-12 8:11
jschell11-Jul-12 8:11 
V. wrote:
What is strange though, is that there is no warning, no exceptions nothing. Just
implicit conversion.


So now is the time to get the following idea into your head...

Timestamps ALWAYS have an associated timezone.
If it isn't explicit then it is implicit.

So anytime you see a timestamp value you MUST determine how the timezone will be determined. Always.

And this has nothing to do with Java. It is true for any programming language and for that matter other types of usage as well.


V. wrote:
So looking at the errors, it says it runs into a unique constraint (dts is
unique). Fine, what value was double then?


And there are other things about timestamps as well...

The resolution for timestamps is not absolute. Especially across boundaries. One example of that is that the MS SQL Server datetime resolution for milli-seconds is less than that of windows. So you can put a value into SQL Server and get it out with a different millisecond value.

Because it isn't absolute relying on it to be unique without quaranteeing the coarseness to be more than a second is probably asking for trouble.

And for Java the resolution of java.sql.Timestamp as represented by the base class java.util.Date is SECONDS, rather than nanoseconds as represented by java.util.Date itself. Read the docs on java.sql.Timestamp for specifics.
GeneralYou know it's time to go home... PinPopular
StM0n10-Jul-12 2:59
StM0n10-Jul-12 2:59 
GeneralRe: You know it's time to go home... Pin
Nagy Vilmos10-Jul-12 3:26
professionalNagy Vilmos10-Jul-12 3:26 
GeneralRe: You know it's time to go home... Pin
spencepk10-Jul-12 7:36
spencepk10-Jul-12 7:36 
GeneralRe: You know it's time to go home... Pin
StM0n10-Jul-12 19:40
StM0n10-Jul-12 19:40 
GeneralRe: You know it's time to go home... Pin
SoMad10-Jul-12 11:51
professionalSoMad10-Jul-12 11:51 
GeneralRe: You know it's time to go home... Pin
henrikqwerty32125-Jul-12 14:52
henrikqwerty32125-Jul-12 14:52 
GeneralDictionary Misuse PinPopular
Martin Thwaites9-Jul-12 4:22
Martin Thwaites9-Jul-12 4:22 
GeneralRe: Dictionary Misuse Pin
Henning Dieterichs9-Jul-12 8:58
Henning Dieterichs9-Jul-12 8:58 
GeneralRe: Dictionary Misuse Pin
PIEBALDconsult9-Jul-12 10:55
mvePIEBALDconsult9-Jul-12 10:55 
GeneralRe: Dictionary Misuse Pin
Harley L. Pebley10-Jul-12 5:16
Harley L. Pebley10-Jul-12 5:16 
GeneralRe: Dictionary Misuse Pin
Martin Thwaites10-Jul-12 5:24
Martin Thwaites10-Jul-12 5:24 
GeneralRe: Dictionary Misuse Pin
Brisingr Aerowing10-Jul-12 6:16
professionalBrisingr Aerowing10-Jul-12 6:16 
AnswerRe: Dictionary Misuse Pin
Harley L. Pebley10-Jul-12 6:21
Harley L. Pebley10-Jul-12 6:21 
GeneralRe: Dictionary Misuse Pin
James Lonero11-Jul-12 4:57
James Lonero11-Jul-12 4:57 
GeneralRe: Dictionary Misuse Pin
Florin Jurcovici12-Jul-12 22:02
Florin Jurcovici12-Jul-12 22:02 
GeneralRe: Dictionary Misuse Pin
ely_bob10-Jul-12 9:55
professionalely_bob10-Jul-12 9:55 
GeneralGreat implementation Pin
cansino6-Jul-12 2:53
cansino6-Jul-12 2:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.