Solved

Coldfusion  working with Julian dates

Posted on 2010-09-14
9
1,083 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
Comment Utility
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
Comment Utility
Still stuck... anyone else?
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
>> 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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

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

Expert Comment

by:_agx_
Comment Utility
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
Comment Utility
Thanks for the help!
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
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
Comment Utility
right you are! thanks again agx.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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, fr…

743 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

8 Experts available now in Live!

Get 1:1 Help Now