ScriptSpot

Forum topic · General Scripting

convert solar Date

By dande · 2010-08-06

Description

I have retrieved the solar Date from the daylight system. But it returns an offset from the summer solstice. So for the 22nd of June it returns 1 and for the 20th of June it returns -1.

Does anybody know how I can convert this information in to a Julian date (21/06/10) or retrieve the values in the actual daylight system control parameters

Comments (4)

method

Amneloris · 2011-05-02

My algorithm is not very complicated,
gets the number of days between 2 dates and then adds (subtracts) the number of day given by Solar_Date
Then, just completed

YES !

Amneloris · 2011-04-29

I've do it ^^

I give you it in 5 minute...

Graph · 2011-04-29

dont work withe dayLight system so ill just point you to a possible solution ;)

Daylight : System

in the maxScript help


$Daylight01.controller
Controller:Sunlight_Daylight_Slave_Controller

 

<Daylight_Slave_Controller>.solar_time Float -- subAnim[3]

The solar time expressed as an integer value of seconds since midnight. To calculate the hours, minutes and seconds, you can use the following function:

SCRIPT:
 
 
fn TimeFromSolarTime dlSystem =
(
  local solar_time = dlSystem.controller.solar_time.controller.value
  local hrs = int solar_time -- full hours in the solar_time value
  local min = int((solar_time-hrs)*60.0) -- full minutes in the difference between the full time and the full hours

  local sec = int((solar_time-hrs-min/60.0)*3600 + 0.5) -- full seconds in the rest of the value

  return #(hrs,min,sec) -- return the result as a 3 elements array
)

 

TimeFromSolarTime $Daylight01

 

<Daylight_Slave_Controller>.solar_date Float -- subAnim[4]

The solar date represents the days offset from June 21st, the date of the Summer Solstice. You should access the .solar_date.controller.value to get the correct value as a Float.

so why not rework the TimeFromSolarTime fn to work withe .solar_date ctrl?

Same Problem

Amneloris · 2011-04-29

I'm working on DayLight System,
And i have de same problem.

hard to convert Solar_date to (MM/JJ/AAAA).

I've found Algo on the web, but, cause i work with a CallBack Fn, i want the conversion was simply.

If anybody can Help please.
(Sorry for my English..... I'm stranger...)