dateToNumber: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (leap behaviour) |
Killzone Kid (talk | contribs) (explained how command works) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Convert a date to a float number, based on Jan 1st 00:00:00 <nowiki>=</nowiki> 0 and Dec 31st 23:59:59 <nowiki>=</nowiki> 1. The same day and time in leap year will be different after 28th of February and 23:59 on 31st of December will be 1.00274 |= Description | | Convert a date to a float number, based on Jan 1st 00:00:00 <nowiki>=</nowiki> 0 and Dec 31st 23:59:59 <nowiki>=</nowiki> 1. The same day and time in leap year will be different after 28th of February and 23:59 on 31st of December will be 1.00274 <br><br> | ||
This is how this command works. The 365 days of the year are presented in range 0...1. So each day will be:<br> | |||
<tt>1 / 365 <nowiki>=</nowiki> 0.00273973</tt> <br> | |||
On leap year there are 366 days, so the range will increase by 1 day:<br> | |||
<tt>1 / 365 * 366 <nowiki>=</nowiki> 1.00274</tt><br> | |||
In short, on normal year the command returns in range 0...1 on leap year it will return in range 0...1.00274|= Description | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| '''dateToNumber''' date |= Syntax | | '''dateToNumber''' date |= Syntax | ||
|p1= date: [[Array]] - |= PARAMETER1 | |p1= date: [[Array]] - array in [[date]] format |= PARAMETER1 | ||
|p2= |= PARAMETER2 | |p2= |= PARAMETER2 |
Revision as of 01:10, 27 February 2016
Description
- Description:
- Convert a date to a float number, based on Jan 1st 00:00:00 = 0 and Dec 31st 23:59:59 = 1. The same day and time in leap year will be different after 28th of February and 23:59 on 31st of December will be 1.00274
This is how this command works. The 365 days of the year are presented in range 0...1. So each day will be:
1 / 365 = 0.00273973
On leap year there are 366 days, so the range will increase by 1 day:
1 / 365 * 366 = 1.00274
In short, on normal year the command returns in range 0...1 on leap year it will return in range 0...1.00274 - Groups:
- Uncategorised
Syntax
Examples
- Example 1:
_float = dateToNumber [2035,7,6,12,0]; //0.510959
- Example 2:
dateToNumber date; //will return float number for the current date.
Additional Information
- See also:
- datedaytimetimenumberToDate
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note