Julian Date conversion

1. Member
Join Date
Dec 1969
Posts
50

## Julian Date conversion

How do we convert a calendar date like 11/26/2004 to Julian date? Does anyone know which function to use for that or how to write it? Thanks in advance!!!

2. God
Senior Member
Join Date
Dec 1969
Posts
18,177

.

3. Member
Join Date
Dec 1969
Posts
50

## RE: What's a Julian date? (eop)

A date that is in the format of the year and the number of the day in the year where January 1st is day 1 and December 31st is day 365, unless the year is a leap year in which case December 31st is day 366. This is shown abstractly as dddyy (01596 is the 15th day of 1996) or as yyddd (96015).

4. God
Senior Member
Join Date
Dec 1969
Posts
18,177

## How's this..

Function JulianDate(ByVal dt)<BR><BR> JulianDate = Right("000" & DatePart("y", dt), 3) & Right(Year(dt), 2)<BR><BR>End Function<BR><BR>Response.Write JulianDt(Now()) & "&#060;br /&#062;"<BR>Response.Write JulianDt(#December 18, 2003#) & "&#060;br /&#062;"

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## Okay, then easy enough...

&#060;%<BR>Function toJulian( dt )<BR> Dim yr, dy<BR> yr = Right( "0" & Year(dt), 2 )<BR> dy = Right( "00" & DatePart( "y", dt ), 3 )<BR> toJulian = yr & dy<BR>or<BR> toJulian = dy & yr<BR>End Function<BR>%&#062;<BR><BR>Or, even simpler:<BR><BR>&#060;%<BR>&#039; gets yyddd format:<BR>Function toJulian( dt )<BR> toJulian = Right( Year(dt)*1000 + DatePart( "y", dt ), 5 )<BR>End Function<BR>%&#062;<BR><BR>or<BR><BR>&#060;%<BR>&# 039; gets dddyy format:<BR>Function toJulian( dt )<BR> toJulian = Right( "00" & ( DatePart( "y", dt ) * 100 + (Year(dt) MOD 100), 5 )<BR>End Function<BR>%&#062;<BR>

6. Senior Member
Join Date
Dec 1969
Posts
96,118

.

7. Member
Join Date
Dec 1969
Posts
50

## RE: Okay, then easy enough...

Thanks this worked!!!

8. Member
Join Date
Dec 1969
Posts
50

## RE: How's this..

Thanks a lot!!! This actually worked really well. I appreciate this!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•