Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
New Zealand
Asked — Edited

Comparing Dates

Hi All

I am trying to write a script that loads a text file and announces messages....
12/11/2013, 12/16/2013, Concert in the Park this week

Problem I have is that EZ-Script runs a calculation on the dates so that they become month divided by Day divided by year... So as a work around I separated the date into integers.
$Start_Month, $Start_Day, $Start_Year, $End_Month, $End_Day, $End_Year, $Message
12, 11, 2013, 12, 16, 2012, Happy Birthday George

Now it seems to me the best way to compare the Start_dates and End_Dates with the current date is to convert them to a digital format first (Preventing complications when dates cross years).

My question for the masses is :
Has anyone got a script to convert a Georgian date into a Julian number?

I can only find complicated formula and ready made converters.
I need to be able to take the three variables $X_Day, $X_Month and $X_Year and end up with a Julian number.



Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

AI Support Bot
Related Content
United Kingdom
Have you tried using different date formats i.e. 2013-01-24?

Georgian to Julian is a very complex formula from what I remember... Is there not an easier way of doing it?
New Zealand
Hey Rich.... Nah I found it problemattic converting back and forth and then comparing strings using the date function.... something DJ has set up stores a different result when I compare and print .... anyway I found a wiki on calculating it so had a go myself... I was just being lazy and wanted to avoid another late night but I'm hooked on a project! (It's 2:45am and I have work in the morning.... LOL)

Anyway I thought I'd post the result here .... it's a little spaghetti and I had to loop it a bit as I had to use the Round function to fill in for the lack of integer function... but where there is a will there is a way.

The calculator will give you the current date as a Julian. Then what ever other date yu convert can be compared to this for an past or future comparison.

#Julian Date Calculator
# Credit to http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html


$A1 = $Y/100
IF ($A1<$A2)
ElseIF ($A1>=$A2)

$B1 = $A/4
IF ($B1<$B2)
ElseIF ($B1>=$B2)

$C1 = 2 - $A + $B
IF ($C1<$C2)
ElseIF ($C1>=$C2)

$E1 = 365.25 * ($Y+4716)
IF ($E1<$E2)
ElseIF ($E1>=$E2)

$F1 = 30.6001 * ($M+1)
IF ($F1<$F2)
ElseIF ($F1>=$F2)

$JD= $C + $D + $E + $F - 1524.5
Print ($JD)