• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1229
  • Last Modified:

Coldfusion working with Julian dates

I want to get yesterdays Julian date. I thought I could just add "-1" to the below code but it doesn't work. can someone show me the correct way to get yesterdays julian date? thanks!

<cfparam name = "dayOfYear" default="#NumberFormat(DayOfYear(Now()),"000")#" >
0
Bang-O-Matic
Asked:
Bang-O-Matic
  • 5
  • 4
1 Solution
 
_agx_Commented:
I've never done it myself. But it doesn't seem as simple as that.  I'd check cflib.org. If you search on "Julian" they've got a couple functions like

http://www.cflib.org/udf/GetJulianDay
http://www.cflib.org/udf/GetModifiedJulianDay
http://www.cflib.org/udf/JulianDayofWeek
0
 
Bang-O-MaticAuthor Commented:
Still stuck... anyone else?
0
 
_agx_Commented:
>> Still stuck... anyone else?

Well .. if you want anyone else to help, I think you'll have to describe what results you're getting _now_ and how they're different from the desired you want ;-)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Bang-O-MaticAuthor Commented:
I think I have it working:

<cfparam name = "julianday" default="#NumberFormat(DayOfYear(Now()))#">
<cfset Yesterday = #julianday# - 1>
<CFOUTPUT>#Yesterday#</CFOUTPUT>

The problem is I have to download new photozips daily and the file names are julian dates like "photozip_257.zip" but the newest file is always dated from the prior day...if that makes sense.
0
 
Bang-O-MaticAuthor Commented:
Lol, point well taken agx, I didnt properly describe the issue.
0
 
_agx_Commented:
No problem :)  I just wanted to make sure you got a good response.  But I'm glad to hear you figured it out yourself.
0
 
Bang-O-MaticAuthor Commented:
Thanks for the help!
0
 
_agx_Commented:
Hmm.. you may want to add special handling for the 1st day of the year. Otherwise #Yesterday# will end up being "0" on January 1st.

<cfparam name = "julianday" default="#DayOfYear(Now())#">
<cfif julianDay eq 1>
      <cfset julianDay = DayOfYear(dateAdd("d", -1, now()))>
</cfif>
<cfset Yesterday = julianDay - 1>
0
 
Bang-O-MaticAuthor Commented:
right you are! thanks again agx.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now