DateRangeManagement

DateRangeManagement

Messagepar oguruma » 26 Mai 2006 à 14:42

Voici une classe LS qui permet PLEIN de choses...
Comparer des dates, formater des dates
elle accepte les dates de type Date, chaine et nombre.
je vous laisse découvrir.
C'est une version initiale, il y aura sans doutes des mises à jour.
Voir ci-dessous. Découpage en trois post.
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar oguruma » 26 Mai 2006 à 16:58

Le contenu de la classe, pour cela créer une librairie DateRangeManagement

'//==================================================================================
'// Classe : DateRangeManagement
'// Auteur : Christian DILLY
'// Version : Initiale
'// Date : 17.05.2006
'//==================================================================================


Public Class DateRangeManagement
Private m_hSession As NotesSession
Private m_vDates(1 To 2) As NotesDateTime
Private m_sError As String
Private m_iError As Integer
Private m_iErrorLine As Integer
Private m_bError As Boolean
Private m_sProc As String
Private m_sErrorMsg As String
Private m_hDateRange As NotesDateRange

Public START_DATE As Integer
Public END_DATE As Integer
Public EQUAL As String
Public GREATER As String
Public LESS As String


'//===================================================================
'// Définition des propriétés
'//===================================================================
Property Get isError As Boolean
isError = m_bError
End Property

Property Get MsgError As String
MsgError=m_sErrorMsg
End Property

Property Get DateRange As NotesDateRange
Set DateRange=m_hDateRange
End Property

' Les dates sont-elles égales
Property Get isEqual As Boolean
isEqual=getEqual()
End Property

Property Get isGreater As Boolean
isGreater=getGreater
End Property

Property Get isLess As Boolean
isLess=getLess
End Property

' Calcule le nombre de jours entre les deux datds
Property Get DaysDifference As Long
DaysDifference=Abs(getDaysDifference)
End Property

' Objet de type NotesDateTime : date de début
Property Get StartDate As NotesDateTime
Set StartDate= m_hDateRange.StartDateTime
End Property

' Objet de type NotesDateTime : date de fin
Property Get EndDate As NotesDateTime
Set EndDate=m_hDateRange.EndDateTime
End Property

' Mise en forme de la date pour une impression
Property Get Text(range As Integer, sFmt As String) As String
text=toString(range, sFmt)
End Property

' Mise en forme des deux dates du genre Du xx/xx/xx Au : xx/xx/xx
Property Get textRange(sep1 As String, sep2 As String, sFmt As String) As String
textRange=sep1 & toString(1, sFmt) & sep2 & toString(2, sFmt)
End Property

Property Get BritishShortDate(range As Integer) As String
BritishShortDate=getFormat(range,"mm/dd/yy")
End Property

Property Get BritishLongDate(range As Integer) As String
BritishLongDate=getFormat(range,"mm/dd/yyyy")
End Property

' N° du jour dans l'année 1 à 365
Property Get DayOfYear(range As Integer) As String
DayOfYear=getFormat(range,"y")
End Property

' Jour dans le mois
Property Get DayOfMonth(range As Integer) As String
DayOfMonth=getFormat(range,"dd")
End Property

' Nom du Jour dans la semaine
Property Get WeekOfDay(range As Integer) As String
WeekOfDay=getFormat(range,"dddd")
End Property

' Date julienne AAJJJ
Property Get JulianDate(range As Integer) As String
JulianDate=getFormat(range,"yy")+Right$("000"+getFormat(range,"y"),3)
End Property

' N° de semaine 1 - 53
Property Get WeekNumber(range As Integer) As String
WeekNumber=getFormat(range,"ww")
End Property

' N° du jour dans la semaine 1=Dimanche ; 7=Samedi
Property Get DayWeekNumber(range As Integer) As String
DayWeekNumber=getFormat(range,"w")
End Property

' Nom du Mois dans l'année
Property Get MonthOfYear (range As Integer) As String
MonthOfYear=getFormat(range,"mmmm")
End Property

' N° du mois dans l'année
Property Get MonthNumber (range As Integer) As String
MonthNumber=getFormat(range,"mm")
End Property

' Année format AA
Property Get ShortYear(range As Integer) As String
ShortYear=getFormat(range,"yy")
End Property

' Année format AAAA
Property Get LongYear(range As Integer) As String
LongYear=getFormat(range,"yyyy")
End Property

' Heure
Property Get Hours (range As Integer) As String
Hours=getFormat(range,"hh")
End Property

'Minute
Property Get Minutes(range As Integer) As String
Minutes=getFormat(range,"ss")
End Property

' Seconde
Property Get Seconds(range As Integer) As String
Seconds=getFormat(range,"ss")
End Property

' Jour (entier)
Property Get DayValue(range As Integer) As Integer
DayValue=Day(m_vDates(range).DateOnly)
End Property

' Mois (entier)
Property Get MonthValue(range As Integer) As Integer
MonthValue=Month(m_vDates(range).DateOnly)
End Property

'Année (entier)
Property Get YearValue(range As Integer) As Integer
YearValue=Year(m_vDates(range).DateOnly)
End Property

'Date julienne (long)
Property Get JulianDateValue(range As Integer) As Long
JulianDateValue=Clng(getFormat(range,"yy")+Right$("000"+getFormat(range,"y"),3))
End Property

' Jour nnn (entier)
Property Get DayOfYearValue(range As Integer) As Integer
DayOfYearValue=Cint(getFormat(range,"y"))
End Property

' Donne seulement la date d'un objet NotesDateTime
Property Get DateOnly (range As Integer) As String
DateOnly=m_vDates(range).DateOnly
End Property

' Donne seulement l'heure d'un objet NotesDateTime
Property Get TimeOnly (range As Integer) As String
TimeOnly=m_vDates(range).TimeOnly
End Property

' Date correcte ?
Property Get IsValideDate(range As Integer) As Boolean
IsValideDate=m_vDates(range).IsValidDate
End Property

Property Get LocalTime (range As Integer) As String
LocalTime=m_vDates(range).LocalTime
End Property

Property Get LsLocalTime(range As Integer) As Variant
LsLocalTime=m_vDates(range).LSLocalTime
End Property

' Heures (entier)
Property Get HoursValue(range As Integer) As Integer
HoursValue=Hour(m_vDates(range).TimeOnly)
End Property

'Minutes (entier)
Property Get MinutesValue(range As Integer) As Integer
MinutesValue=Hour(m_vDates(range).TimeOnly)
End Property

' Secondes (entier)
Property Get SecondsValue(range As Integer) As Integer
SecondsValue=Minute(m_vDates(range).TimeOnly)
End Property

Property Get Bissextile(range As Integer) As Boolean
Bissextile=isBissextile(range)
End Property


'//===========================================================
'// Constructeur
'//===========================================================
'// m_vDate(1) = Date de début (vDate1)
'// m_vDate(2) = Date de fin (vDate2)
'//===========================================================
Sub new (vDate1 As Variant, vDate2 As Variant)
On Error Goto ERROR_NEW
' Constantes
START_DATE=1
END_DATE=2
EQUAL="0"
GREATER="1"
LESS="-1"
' Initialisation session
Set m_hSession=New NotesSession
' DateRange
Set m_hDateRange=m_hSession.CreateDateRange
' Dans ce cas on affecte la date du jour
If Trim$(vDate1)="" Then
vDate1=Now
End If
' Borne 1 du tableau
If Not EvaluateDate(vDate1,1) Then
Exit Sub
End If
'Idem date du jour
If Trim$(vDate2)="" Then
vDate2=Now
End If
' Borne 2 du tableau
If Not EvaluateDate(vDate2,2) Then
Exit Sub
End If
' Création de l'étendue de date
Call initDateRange
Exit Sub
FIN_ERROR_NEW:
Exit Sub
ERROR_NEW:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_NEW
End Sub


'//=====================================================================
'// Procédures et fonctions publiques accessibles via l'instanciation
'//=====================================================================


'//=======================================================
'// Changes les bornes
'//=======================================================
Public Sub SetDate(range As Integer, vDate As Variant)
On Error Goto ERROR_SETDATE
If Trim$(vDate)="" Then
vDate=Now
End If
If Not EvaluateDate(vDate,range) Then
Exit Sub
End If
Call initDateRange
Exit Sub
FIN_ERROR_SETDATE:
Exit Sub
ERROR_SETDATE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_SETDATE
End Sub


'//=======================================================
'// Ecrit à la date sous forme texte
'//=======================================================
Public Function ToString(range As Integer, sFmt As String) As String
Dim strTmp As String
On Error Goto ERROR_TOSTRING
ToString=getFormat(range,sFmt)
FIN_ERROR_TOSTRING:
Exit Function
ERROR_TOSTRING:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_TOSTRING
End Function

'//=======================================================
'// Equivalent de la fonction @Adjust
'//=======================================================
Public Function Adjust(range As Integer, dd As Integer, mm As Integer, aa As Integer, hh As Integer, nn As Integer, ss As Integer) As NotesDateTime
On Error Goto ERROR_ADJUST
Call AdjustDay(range,dd)
Call AdjustMonth(range,mm)
Call AdjustYear(range,aa)
Call AdjustHour(range,hh)
Call AdjustMinute(range,nn)
Call AdjustSecond(range,ss)
Set Adjust=m_vDates(range)
FIN_ERROR_ADJUST:
Exit Function
ERROR_ADJUST:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_ADJUST
End Function

' Variation Jours
Public Function AdjustDay(range As Integer, iDay As Integer) As NotesDateTime
Call m_vDates(range).AdjustDay(iDay)
Set AdjustDay=m_vDates(range)
End Function

' Variation Mois
Public Function AdjustMonth(range As Integer, iMonth As Integer) As NotesDateTime
Call m_vDates(range).AdjustMonth(iMonth)
Set AdjustMonth=m_vDates(range)
End Function

' Variation Années
Public Function AdjustYear(range As Integer, iYear As Integer) As NotesDateTime
Call m_vDates(range).AdjustYear(iYear)
Set AdjustYear=m_vDates(range)
End Function

' Variation Heures
Public Function AdjustHour(range As Integer, iHour As Integer) As NotesDateTime
Call m_vDates(range).AdjustHour(iHour)
Set AdjustHour=m_vDates(range)
End Function

' Variation Minutes
Public Function AdjustMinute(range As Integer, iMinute As Integer) As NotesDateTime
Call m_vDates(range).AdjustMinute(iMinute)
Set AdjustMinute=m_vDates(range)
End Function

' Variation Secondes
Public Function AdjustSecond(range As Integer,iSecond As Integer) As NotesDateTime
Call m_vDates(range).AdjustSecond(iSecond)
Set AdjustSecond=m_vDates(range)
End Function

'//=======================================================
'// Compare les deux dates
'//=======================================================
Public Function CompareDate() As String
Dim delta As Long
Dim sResult As String
delta=getDaysDifference
If delta=0 Then
sResult=EQUAL
Elseif delta>0 Then
sResult=GREATER
Else
sResult=LESS
End If
CompareDate=sResult
End Function

'//=======================================================
'// Calcul le nombre de jours entre deux dates
'//=======================================================
Public Function getDaysDifference() As Long
Dim lngDelta As Long
On Error Goto ERROR_DAYSDIFFERENCE
lngDelta=m_vDates(1).TimeDifference(m_vDates(2))
getDaysDifference=lngDelta/86400
FIN_ERROR_DAYSDIFFERENCE:
Exit Function
ERROR_DAYSDIFFERENCE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_DAYSDIFFERENCE
End Function

Public Function getDaysDoubleDifference() As Double
Dim lngDelta As Double
On Error Goto ERROR_DAYSDOUBLEDIFFERENCE
lngDelta=m_vDates(1).TimeDifferenceDouble(m_vDates(2))
getDoubleDaysDifference=lngDelta/86400
FIN_ERROR_DAYSDOUBLEDIFFERENCE:
Exit Function
ERROR_DAYSDOUBLEDIFFERENCE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_DAYSDOUBLEDIFFERENCE
End Function

'//=======================================================
'// Une année (integer) est-elle bissextile ?
'//=======================================================
Public Function isYearBissextile(iAnnee As Integer) As Boolean
On Error Goto ERROR_ISYEARBISSEXTILE
isYearBissextile=False
If ((iAnnee Mod 4 = 0) And (iAnnee Mod 100 <> 0)) Or iAnnee Mod 400 =0 Then
isYearBissextile=True
End If
FIN_ERROR_ISYEARBISSEXTILE:
Exit Function
ERROR_ISYEARBISSEXTILE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_ISYEARBISSEXTILE
End Function



'//=====================================================================
'// Procédures et fonctions protégées (private)
'//=====================================================================

'//=======================================================
'// Evalue une donnée date de tous types
'//=======================================================
Private Function EvaluateDate(vDate As Variant,range As Integer)
Dim vTmpDate As Variant
On Error Goto ERROR_EVALUATE_DATE
' Contrôle si la date est correcte en cas de chaine de caractères
If Typename(vDate)="STRING" Then
If Not Isdate(vDate) Then
Exit Function
End If
End If
' Pour où la date serait au format numérique on la convertie en objet date
vTmpDate=vDate
If Isnumeric(vDate) Then
vTmpDate=Cdat(vDate)
End If
' On affecte la borne du tableau
Set m_vDates(range)=New NotesDateTime(vTmpDate)
EvaluateDate=True
FIN_ERROR_EVALUATE_DATE:
Exit Function
ERROR_EVALUATE_DATE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_EVALUATE_DATE
End Function

'//=======================================================
'// Initialisation de l'étendue de date
'// m_vDate(1) = Date de début
'// m_vDate(2) = Date de fin
'//=======================================================
Private Sub initDateRange
On Error Goto ERROR_INITRANGE
Set m_hDateRange.StartDateTime = m_vDates(1)
Set m_hDateRange.EndDateTime = m_vDates(2)
FIN_ERROR_INITRANGE:
Exit Sub
ERROR_INITRANGE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_INITRANGE
End Sub

'//=======================================================
'// Permet de renvoyer un format de date
'//=======================================================
Private Function getFormat(range As Integer,sFormat As String) As String
Dim sExpDate As String
sExpDate=m_vDates(range).DateOnly & " " & m_vDates(range).TimeOnly
On Error Goto ERROR_GETFORMAT
getFormat=Format$(sExpDate,sFormat)
FIN_ERROR_GETFORMAT:
Exit Function
ERROR_GETFORMAT:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_GETFORMAT
End Function

'//=======================================================
'// Les dates sont-elles égales
'//=======================================================
Private Function getEqual() As Boolean
On Error Goto ERROR_GETEQUAL
If getDaysDifference()=0 Then
getEqual=True
Else
getEqual=False
End If
FIN_ERROR_GETEQUAL:
Exit Function
ERROR_GETEQUAL:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_GETEQUAL
End Function

'//=======================================================
'// Date1 est-elle inférieure à la Date2
'//=======================================================
Private Function getLess() As Boolean
On Error Goto ERROR_GETLESS
If getDaysDifference()<0 Then
getLess=True
Else
getLess=False
End If
FIN_ERROR_GETLESS:
Exit Function
ERROR_GETLESS:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_GETLESS
End Function

'//=======================================================
'// Date1 est-elle supérieure à la Date2
'//=======================================================
Private Function getGreater() As Boolean
On Error Goto ERROR_GETGREATER
If getDaysDifference()>0 Then
getGreater=True
Else
getGreater=False
End If
FIN_ERROR_GETGREATER:
Exit Function
ERROR_GETGREATER:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_GETGREATER
End Function

'//=========================================================
'// L'année est-elle bissextile
'// Pour mémoire voici comment on la détermine
'// elle est multiple de 4
'// ses deux chiffres ne doivent pas être 00 sauf si elle est divisible par 400
'//=========================================================
Private Function isBissextile(range As Integer) As Boolean
Dim iAnnee As Integer
On Error Goto ERROR_BISSEXTILE
isBissextile=False
iAnnee=Year(m_vDates(range).DateOnly)
isBissextile=isYearBissextile(iAnnee)
FIN_ERROR_BISSEXTILE:
Exit Function
ERROR_BISSEXTILE:
Call PrintError(Err,Error$,Erl,Lsi_info(2))
Resume FIN_ERROR_BISSEXTILE
End Function


'//=======================================================
'// Gestion des erreurs de runtime
'//=======================================================
Private Sub PrintError (iErr As Integer,sError As String, iErrLine As Integer, sProc As String)
m_iError=iErr
m_sError=sErr
m_iErrorLine=iErrLine
m_bError=True
m_sProc=sProc
m_sErrorMsg="Erreur n° " & iErr & " : " & sError & " - ligne " & iErrLine
' On prévoit le cas d'un fonctionnement sur serveur
If m_hSession.IsOnServer Then
Print m_sErrorMsg & " [DateRangeManagement]"
Else
Msgbox m_sErrorMsg,16,"DateRangeManagement"
End If
Print m_sErrorMsg
End Sub

Public Sub delete

End Sub
End Class
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar oguruma » 26 Mai 2006 à 17:07

Un exemple d'utilisation

Sub Click(Source As Button)
Dim hSession As NotesSession
Dim hWS As NotesUIWorkspace
Dim hUIDOC As NotesUIDocument
Dim hDoc As NotesDocument

' Objet pour travailler sur deux dates
Dim hDRM As DateRangeManagement
' Objet pour utiliser les dates du jour par défaut
Dim hDRMNow As DateRangeManagement

On Error Goto HANDLE_ERROR
Set hSession=New NotesSession
Set hWS=New NotesUIWorkspace
Set hUIDOC=hWS.CurrentDocument
Set hDoc=hUIDOC.Document

'//============================================================================
'// Déclaration de l'objet
'//============================================================================
Set hDRM=New DateRangeManagement(hDoc.DateDebut1(0),hDoc.DateFin1(0))

'//============================================================================
'// On se récupère le nombre de jours entre les deux dates
'// en valeur absolue
'//============================================================================
hDoc.DaysDifference=hDRM.DaysDifference()
hDoc.getDaysDifference=hDRM.getDaysDifference()

'//============================================================================
'// On jongle avec la date du jour par défaut
'// Date de début et de fin sont à la date du jour (@Now)
'//============================================================================
Set hDRMNow=New DateRangeManagement("","")

'//============================================================================
'// Date de début
'// type string
'//============================================================================
hDoc.DayOfYear= hDRM.DayOfYear(hDRM.START_DATE)
hDoc.DayOfMonth=hDRM.DayOfMonth(hDRM.START_DATE)
hDoc.WeekOfDay=hDRM.WeekOfDay(hDRM.START_DATE)
hDoc.JulianDate=hDRM.JulianDate(hDRM.START_DATE)
hDoc.WeekNumber=hDRM.WeekNumber(hDRM.START_DATE)
hDoc.DayWeekNumber=hDRM.DayWeekNumber(hDRM.START_DATE)
hDoc.MonthNumber=hDRM.MonthNumber(hDRM.START_DATE)
hDoc.ShortYear=hDRM.ShortYear(hDRM.START_DATE)
hDoc.LongYear=hDRM.LongYear(hDRM.START_DATE)

'//============================================================================
'// Tester l'égalité des dates, plus grand, plus petit
'//============================================================================
If hDRM.isEqual Then
hDoc.Equal="Oui"
Else
hDoc.Equal="Non"
End If

If hDRM.isGreater Then
hDoc.Greater="Oui"
Else
hDoc.Greater="Non"
End If

If hDRM.isLess Then
hDoc.Less="Oui"
Else
hDoc.Less="Non"
End If

'//=============================================================================
'// Autre manière de tester les dates
'//=============================================================================
'// Récupère
'// hDRM.EQUAL soit "0"
'// hDRM.GREATER soit "1"
'// hDRM.LESS soit "-1"
hDoc.DateCompare=hDRM.CompareDate()

'// On peut aussi s'appuyer sur les constantes renvoyées par la classe
If hDRM.CompareDate()=hDRM.GREATER Then
Msgbox "Date 1 > Date 2"
End If

If hDRM.CompareDate()=hDRM.EQUAL Then
Msgbox "Date 1 = Date 2"
End If

If hDRM.CompareDate()=hDRM.LESS Then
Msgbox "Date 1 < Date 2"
End If

'//============================================================================
'// Tester les années bissextiles
'//============================================================================
If hDRM.Bissextile(hDRM.START_DATE) Then
hDoc.Bissextile="Oui"
Else
hDoc.Bissextile="Non"
End If

If hDRM.Bissextile(hDRM.END_DATE) Then
hDoc.Bissextile_1="Oui"
Else
hDoc.Bissextile_1="Non"
End If

'//==============================================================================
'// Bon.... les british avec leur Tout à l'envers on ne va pas les oublier dans la bagarrrrrre !!!
'// toujours autrement que les autres... :((
'//==============================================================================
hDoc.BritishShortDate=hDRM.BritishShortDate(hDRM.START_DATE)
hDoc.BritishShortDate_1=hDRM.BritishShortDate(hDRM.END_DATE)
hDoc.BritishLongDate=hDRM.BritishLongDate(hDRM.START_DATE)
hDoc.BritishLongDate_1=hDRM.BritishLongDate(hDRM.END_DATE)


'//============================================================================
'// type integer - Long
'//============================================================================
hDoc.DayValue=hDRM.DayValue(hDRM.START_DATE)
hDoc.MonthValue=hDRM.MonthValue(hDRM.START_DATE)
hDoc.YearValue=hDRM.YearValue(hDRM.START_DATE)
hDoc.JulianDateValue=hDRM.JulianDateValue(hDRM.START_DATE)
hDoc.DayOfYearValue=hDRM.DayOfYearValue(hDRM.START_DATE)
hDoc.DateOnly=hDRM.DateOnly(hDRM.START_DATE)
hDoc.TimeOnly=hDRM.TimeOnly(hDRM.START_DATE)
hDoc.TimeOnly=hDRM.TimeOnly(hDRM.START_DATE)
hDoc.LocalTime=hDRM.LocalTime(hDRM.START_DATE)


'//============================================================================
'// Date de fin
'//============================================================================
hDoc.DayOfYear_1= hDRM.DayOfYear(hDRM.END_DATE)
hDoc.DayOfMonth_1=hDRM.DayOfMonth(hDRM.END_DATE)
hDoc.WeekOfDay_1=hDRM.WeekOfDay(hDRM.END_DATE)
hDoc.JulianDate_1=hDRM.JulianDate(hDRM.END_DATE)
hDoc.WeekNumber_1=hDRM.WeekNumber(hDRM.END_DATE)
hDoc.DayWeekNumber_1=hDRM.DayWeekNumber(hDRM.END_DATE)
hDoc.MonthNumber_1=hDRM.MonthNumber(hDRM.END_DATE)
hDoc.ShortYear_1=hDRM.ShortYear(hDRM.END_DATE)
hDoc.LongYear_1=hDRM.LongYear(hDRM.END_DATE)
hDoc.DateOnly_1=hDRM.DateOnly(hDRM.END_DATE)
hDoc.TimeOnly_1=hDRM.TimeOnly(hDRM.END_DATE)
hDoc.LocalTime_1=hDRM.LocalTime(hDRM.END_DATE)


'//============================================================================
'// Type integer - Long
'//============================================================================
hDoc.DayValue_1=hDRM.DayValue(hDRM.END_DATE)
hDoc.MonthValue_1=hDRM.MonthValue(hDRM.END_DATE)
hDoc.YearValue_1=hDRM.YearValue(hDRM.END_DATE)
hDoc.JulianDateValue_1=hDRM.JulianDateValue(hDRM.END_DATE)
hDoc.DayOfYearValue_1=hDRM.DayOfYearValue(hDRM.END_DATE)

'//============================================================================
'// Exemples de formatages
'//============================================================================
hDoc.textRange=hDRM.TextRange(" Du : " , " Au : ","ddd dd mmm yyyy")
hDoc.Text=hDRM.Text(hDRM.START_DATE,"dddd dd mmm yyyy")
hDoc.Text_1=hDRM.Text(hDRM.END_DATE,"ddd dd mmm yyyy")
hDoc.StartDate=hDRM.StartDate.DateOnly & " " & hDRM.StartDate.TimeOnly
hDoc.EndDate=hDRM.EndDate.DateOnly & " " & hDRM.EndDate.TimeOnly

'//============================================================================
'// On fait varier le temps
'//============================================================================
hDoc.Adjust=hDRM.Adjust(hDRM.START_DATE,2,1,5,0,0,0).DateOnly
hDoc.Adjust_1=hDRM.Adjust(hDRM.END_DATE,7,5,4,0,0,0).DateOnly

'//============================================================================
'// On joue NOW valeur par défaut hDRMNow
'//============================================================================
hDoc.NowDate=hDRMNow.Text(hDRMNow.START_DATE,"dddd dd mmm yyyy")

'//============================================================================
'// On va changer les bornes date de début et fin
'//============================================================================
Call hDRM.SetDate(hDRM.START_DATE,"12/09/1962")
Call hDRM.SetDate(hDRM.END_DATE,"03/02/60")
hDoc.Borne1=hDRM.StartDate.DateOnly & " " & hDRM.StartDate.TimeOnly
hDoc.Borne2=hDRM.EndDate.DateOnly & " " & hDRM.EndDate.TimeOnly

FIN:
Exit Sub
HANDLE_ERROR:
Msgbox "erreur n° " & Err & " : " & Error$ & " ligne " & Erl
Resume FIN
End Sub
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar oguruma » 26 Mai 2006 à 17:10

Et pour conclure le fichier d'exemple (v6 impérativement)
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar Stephane Maillard » 26 Mai 2006 à 17:34

Salut,

Eh bien dis donc quel beau boulot. :D
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar oguruma » 27 Mai 2006 à 11:00

tu sais... deux heures de TGV/Jour et le portable dans le sac à dos... il faut bien passer le temps avec un peu de lecture aussi...
ça fait une petite semaine que je suis dessus.

ça me fait oublier les ab...tis qui téléphonent pour dire "allo je suis dans le train..."
ça je peux dire que c'est ....

j'espère que ça apportera des éléments de réponses à ceux qui galèrent sur les dates et pour avoir aussi "merdé" dans le passé... je me suis dit pourquoi pas faire une classe qui résoud tout ceci....

la base de démo est là pour ça : si tu vois d'autres trucs... je te remercie... le code est Free OpenSource

je regrette que la surcharge n'est pas admise en ls et que l'on ne puisse pas redéfinir des fonctions ou procédures comme en java car j'aurai pu encore faire mieux... je pense cependant qu'il doit y avoir un moyen c'est pour cela que j'ai annoncé "version initiale"
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE


Retour vers Date