Solved

Coldfusion  working with Julian dates

Posted on 2010-09-14
9
1,096 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
 

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now