Learn R Programming

astrolibR (version 0.1)

ymd2dn: Convert from year, month, day to day number of year

Description

Convert from year, month, day to day number of year

Usage

ymd2dn(yr, m, d)

Arguments

yr
4-digit year (like 1988), integer, scalar or vector
m
month number, integer (1-12), scalar or vector
d
day of month, integer (1-31), scalar or vector

Value

dy
day number in year, integer (1-365), scalar or vector

Details

On error, the function returns
m = d = -1
.

Conversion in the opposite direction is given by function ydn2md.

Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory This software may be used, copied, or redistributed as long as it is not sold and this copyright notice is reproduced on each copy made. This routine is provided as is without any express or implied warranties whatsoever. Other limitations apply as described in the file disclaimer.txt.

Examples

Run this code
#  Find the days of the year for June 4 and September 12 in the year 2001
#  Result: days 155 and 255 

ymd2dn(2001, c(6,9), c(4,12))

Run the code above in your browser using DataLab