home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7643 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.6 KB

  1. Path: sparky!uunet!haven.umd.edu!mimsy!nmrdc1!frmug!lill!vanney.raphael
  2. From: vanney.raphael@lill.frmug.fr.mugnet.org (Vanney Raphael)
  3. Newsgroups: comp.lang.pascal
  4. Subject: RE: DATE -> DAY OF WEEK C
  5. Message-ID: <967.6.uupcb@lill.frmug.fr.mugnet.org>
  6. Date: 20 Dec 92 19:34:00 GMT
  7. Reply-To: vanney.raphael@lill.frmug.fr.mugnet.org (Vanney Raphael)
  8. Organization: Li'LL BBS - Paris, France
  9. Lines: 50
  10.  
  11.  
  12.  -=> Quoting Ijaz Rashid Malik to All <=-
  13.  
  14.  IRM> Newsgroups: comp.lang.c,comp.lang.pascal,comp.lang.c++
  15.  IRM> From: ummalik@ccu.umanitoba.ca (Ijaz Rashid Malik)
  16.  IRM> Subject: Date -> Day of week conversion
  17.  IRM> Followup-To: poster
  18.  IRM> Organization: University of Manitoba, Winnipeg, Canada
  19.  IRM> Date: Fri, 11 Dec 1992 12:48:19 GMT
  20.  
  21.  
  22.  IRM> Could someone please forward me algorithm to convert the date (in
  23.  IRM> dd.mm.yy or yy.mm.dd format, but assume individual fields can be
  24.  IRM> obtained as integers) to corresponding day of the week.
  25.  
  26.  IRM> Thanks very much.
  27.  
  28.  IRM> Malik
  29.  
  30.  
  31.  IRM> -!- GEcho 1.00
  32.  IRM>  ! Origin: Li'LL BBS - Paris France - (33-1) 43.07.40.97 (2:320/7)
  33.  
  34. Here is an efficient-if-not-clean way of doing this :
  35.  
  36. Uses DOS ;
  37.  
  38. Function DayOfWeek(d, m, y : Word) : Word ;
  39. Var  sd,
  40.      sm,
  41.      sy,
  42.      Dum  : Word ;
  43. Begin
  44.      GetDate(sy, sm, sd, Dum) ;
  45.      SetDate(y, m, d) ;
  46.      GetDate(y, m, d, Dum) ;
  47.      DayOfWeek:=Dum ;
  48.      SetDate(sy, sm, sd) ;
  49. End ;
  50.  
  51. -> why not let the DOS do the job ! :-))
  52.  
  53.                                              Raphael.
  54.  
  55.  
  56. ... The last thing I saw was this Big Blue Wave!
  57. --- FMail 0.92
  58.  * Origin: ICEBERG - La Garenne * FRANCE * Tel:(33)-1-47699261
  59. (2:320/1.0)
  60.                                                              
  61.