Solved

Coldfusion  working with Julian dates

Posted on 2010-09-14
9
1,131 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

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

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.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …

733 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