none
Julian Date to Date(time) Conversion

Answers

  • SELECT DATEADD(YEAR, @JulianDate / 1000 - 1900, @JulianDate % 1000 - 1)
    
    
    Friday, February 11, 2011 10:50 PM
  • And the other way around

    SELECT	DATENAME(YEAR, GETDATE()) + RIGHT('00' + DATENAME(DAYOFYEAR, GETDATE()), 3)
    
    Friday, February 11, 2011 11:00 PM
  • Calendar table look up. 

    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL

    Wednesday, April 09, 2014 1:40 AM
  • I don't know what Microsoft would advise, but I have to wonder why you would store a julian date in a char column to begin with.  It seems like your best practices concern would disappear if you stored your julian data in an int column.

     

    Thinking about it another way, why use 7 bytes to store this value when an int only takes 4 bytes?

    Saturday, February 12, 2011 2:31 PM

All replies