comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: days of the week
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: days of the week [message #29867 is a reply to message #29866] Wed, 20 March 2002 08:26 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:

> Bastienne Schneiter (b.schneiter@meteonews.ch) writes:
>
>> I need to show a date in a little application. Its format is
>> YYYYMMDDHH. But I also have to show to which day of the week this date
>> correspond (MON, TUE etc).
>> Does anybody know how to determine the day of the week for a given
>> date?
>
> Here is a bonus question. What is the significance
> of a meteorological event that happens on a Thursday?

I think you mean an "astronomical" or "celestial" event, and it
actually happens today at 19:16:08 UTC.

To answer Bastienne's original question, it's actually easier to
compute the day of the week than the calendar date. That's because
there are no "leap" weekdays, or irregularly sized weeks. Weeks are
always exactly seven days long.

We know that March 24, 2002, is a Sunday. Thus, we can compute the
day of the week using the MOD function:

dayweek = (julday(month,day,year) - julday(3,24,2002)) MOD 7
dayweek = (dayweek + 7) MOD 7

Where 0 means Sunday and 6 means Saturday. The second statement is to
handle cases when DAYWEEK is negative, which happens with the MOD
function unfortunately.

Craig

P.S. I think the built-in JULDAY function is the one of the most
dangerous function I have ever seen. It measures *calendar dates*
from *noon* by gosh! It also doesn't handle fractional days, which is
a pity, but thankfully there are tons of IDL Astro/JHU functions which
overcome this.

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: A little handy date function
Next Topic: Re: IDL Movie Viewer

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:51:37 PDT 2025

Total time taken to generate the page: 0.00446 seconds