ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Quelques fonctions date   



L'auteur

Gregory Adam
Belgique Belgique
Membre Actif (personne physique)
# 0000001121
enregistré le 04/06/2006

Fiche personnelle


Note des membres
16,5/20
2 votes


Contributions > 01 - PRG : Programmation > Temps - heures - Dates - Calendriers

Quelques fonctions date
# 0000000420
ajouté le 06/03/2007 12:33:08 et modifié le 06/03/2007
consulté 9294 fois
Niveau débutant

Version(s) Foxpro :
VFP 9.0
VFP 8.0
VFP 7.0
VFP 6.0
VFP 5.0
VFP 3.0
FPW 2.6

Description

#jour:  Lundi = 1, Mardi = 2, .... Dimanche = 7

  • Year_FirstDay(Annee, #jour)
    • le premier lun/mar/.../dim d'une annee
  • YearMonth_FirstDay(Annee, mois, #jour)
    • le premier lun/mar/.../dim d'une annee + mois
  • Date_Month_First(date, #jour)
    • le premier lun/mar/.../dim d'un mois fourni en date
  • bomonth(d)
    • debut du mois
  • eomonth(d)
    • fin du mois
Code source :
*---------------------------------------------------------------------------
&& First mon/tue/.../sun of year
function Year_FirstDay(YearNumber, DayNumber)

  return date_ToFirst_day(date(m.YearNumber, 1, 1), m.DayNumber)

endfunc
*---------------------------------------------------------------------------
&& First mon/tue/.../sun of year, month
function YearMonth_FirstDay(YearNumber, MonthNumber, DayNumber)

  return date_ToFirst_day(date(m.YearNumber, m.MonthNumber, 1), m.DayNumber)

endfunc
*---------------------------------------------------------------------------
&& First mon/tue/.../sun of a month
function Date_Month_First(d, DayNumber)

  return date_ToFirst_day(bomonth(m.d), m.DayNumber)

endfunc
*---------------------------------------------------------------------------
function  bomonth(d)  && beginning of month
  return m.d+1-day(m.d)
endfunc
*---------------------------------------------------------------------------
function  eomonth(d)  && end of month
  return gomonth(bomonth(m.d),1)-1
endfunc
*---------------------------------------------------------------------------
function date_ToFirst_day(d, DayNumber)
  return m.d + mod(7 - dow(m.d, 2) + m.DayNumber, 7)
endfunc
*---------------------------------------------------------------------------
Commentaires
Aucun commentaire enregistré ...

Publicité

Les pubs en cours :


www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3