Skip to content

NULL DateTime via getDateTime(double minutes, DateTime date) #4

@drwison

Description

@drwison

Hi,
just a note on the getDateTime(double minutes, DateTime date) function: it returns null for negative minutes which may be incorrect. Depending on the timezone & location, negative minutes may be correct in which case the returned date should be on the previous day, something like:
if (hour<0){
DateTime negDate = new DateTime(date.Year, date.Month, date.Day, 0, (int)minute, (int)second);
return negDate.AddHours((int)hour);
}
Example would be determining sunrise in UTC for a location like Sydney, Australia,Tokyo etc.

Cheers
Will

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions