Solved

Coldfusion  working with Julian dates

Posted on 2010-09-14
9
1,115 Views
Last Modified: 2012-06-27
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
Comment
Question by:Bang-O-Matic
  • 5
  • 4
9 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 33675056
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
 

Author Comment

by:Bang-O-Matic
ID: 33676600
Still stuck... anyone else?
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33677485
>> 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:Bang-O-Matic
ID: 33677728
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
 

Author Comment

by:Bang-O-Matic
ID: 33677738
Lol, point well taken agx, I didnt properly describe the issue.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33677929
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
 

Author Closing Comment

by:Bang-O-Matic
ID: 33677968
Thanks for the help!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33678578
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
 

Author Comment

by:Bang-O-Matic
ID: 33678927
right you are! thanks again agx.
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question