Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2003, 11:16 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Julian Date

Dear All,

What I need is to pass a current date and get the last date of the year as julian date, i.e. in this format 731580.

(if 731580 is converted to date then it will read like 31-Dec-2003, this is just an example :))

Thanks for your help.

Praveen Motupally
 
Old November 11th, 2003, 04:54 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How did you get 31-Dec-2003 from 731580.
This will have to be done with a UDF or Stored procedure. I do not know of a function that automatically does it.

check this links, maybe they will help.

http://www.sqlmag.com/Forums/message...2&threadid=496

http://www.sqlmag.com/Forums/message...threadid=15365




Sal
 
Old November 12th, 2003, 04:38 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sal,

Yes this has to be done in the SP or UDF, any example will be greatly appreciated.

All the dates are stored as julian dates in out DB, I need to get all the records upto the current year end, so, for example we pass the current julian date then it has to return the last date of that year.

Regards

Praveen Motupally
 
Old November 12th, 2003, 05:09 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What format of julian date are you using. I have done this with Java, but not with SQL Server. If you do a search on the web, you can find sample code, mostly in C, for calculating the julian date (Day Of Year). I will dig into my stuff and see if I find it.



Sal
 
Old November 13th, 2003, 11:39 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is the format we use 731442 to store the date, for everydate I need to find the last day of the year. like to do this in the stored procedure.

Thanks

Praveen Motupally





Similar Threads
Thread Thread Starter Forum Replies Last Post
Julian Date stealthdevil Visual Basic 2005 Basics 1 November 8th, 2007 12:07 PM
Convert Julian date motupally SQL Server 2000 3 July 5th, 2006 08:12 AM
converting date to julian date ramlaks SQL Server 2000 1 August 23rd, 2004 10:28 AM
Julian Date pmotupal SQL Server 2000 0 January 12th, 2004 05:37 PM
Julian Date format motupally SQL Language 0 August 13th, 2003 11:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.