What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Help to a newbie?

Help to a newbie?
Author: Message:
Fröt
Junior Member
**

Avatar
No

Posts: 16
36 / Male / –
Joined: Feb 2005
Status: Away
O.P. RE: Help to a newbie?
code:

Function DiferenciaEnFechas(pdFechaBase As Date, pdFecha As Date) As String
    Dim dFechaAux As Date
    Dim iYear As Integer, iMes As Integer, iDia As Integer
    Dim iYearFinal As Integer
    Dim iMesFinal As Integer
    Dim iDiaFinal As Integer
    Dim sTiempo As String, sAux As String
    iDia = DatePart("d", pdFecha)
    iMes = Month(pdFechaBase)
    iYear = Year(pdFechaBase)
    dFechaAux = DateSerial(iYear, iMes, iDia)
    iDiaFinal = DateDiff("d", dFechaAux, pdFechaBase)
    iMes = DateDiff("m", pdFecha, pdFechaBase)
    Select Case iMes
        Case Is > 0
        iYearFinal = iMes \ 12
        iMesFinal = iMes Mod 12
        If iDiaFinal < 0 Then
            If Month(dFechaAux) <> Month(pdFechaBase) Then
                iDiaFinal = 31 - (DatePart("d", DateAdd("d", -1, DateSerial(iYear, Month(dFechaAux), 1))))
                dFechaAux = DateAdd("m", -1, dFechaAux)
                dFechaAux = DateAdd("d", -iDiaFinal, dFechaAux)
            Else
                dFechaAux = DateAdd("m", -1, dFechaAux)
            End If

            iDiaFinal = DateDiff("d", dFechaAux, pdFechaBase)


            If iMesFinal > 0 Then
                iMesFinal = iMesFinal - 1
            Else


                If iYearFinal > 0 Then
                    iYearFinal = iYearFinal - 1
                    iMesFinal = 11
                End If

            End If

        End If

        sTiempo = "Pasado: "
        Case Is = 0
        iYearFinal = 0
        iMesFinal = 0


        If iDiaFinal < 0 Then 'Futuro
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux)
            sTiempo = "Futuro: "
        ElseIf iDiaFinal = 0 Then 'HOY
            sTiempo = "HOY: "
        Else 'Pasado
            sTiempo = "Pasado: "
        End If

        Case Else 'Futuro
        iMes = DateDiff("m", pdFechaBase, pdFecha)
        iYearFinal = iMes \ 12
        iMesFinal = iMes Mod 12
       


        If iDiaFinal > 0 Then
            dFechaAux = DateAdd("m", 1, dFechaAux)
           
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux)


            If iMesFinal > 0 Then
                iMesFinal = iMesFinal - 1
            Else


                If iYearFinal > 0 Then
                    iYearFinal = iYearFinal - 1
                    iMesFinal = 11
                End If

            End If

        Else
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux)
        End If

        sTiempo = "Futuro: "
    End Select

sAux = Str(iYearFinal)


If iYearFinal = 1 Then
    sAux = sAux & " Ańo, "
Else
    sAux = sAux & " Ańos, "
End If

sAux = sAux & Str(iMesFinal)


If iMesFinal = 1 Then
    sAux = sAux & " Mes, "
Else
    sAux = sAux & " Meses, "
End If

sAux = sAux & Str(iDiaFinal)


If iDiaFinal = 1 Then
    sAux = sAux & " Día"
Else
    sAux = sAux & " Dia"
End If



DiferenciaEnFechas = sTiempo & sAux

Dim a, b, c As Integer
a = Left(Right(DiferenciaEnFechas, 6), 2)
b = Left(Right(DiferenciaEnFechas, 16), 1)
If Left(a, 1) = " " Then
a = Right(a, 1)
End If
If b = " " Then
b = 0
End If

c = a + (b * 30)


DiferenciaEnFechas = c
End Function




my function is above!

can anybody send the plugin code for me to understand at last?


i think i wanted very much things.:^)

This post was edited on 02-11-2005 at 09:41 PM by Fröt.
02-11-2005 08:26 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Help to a newbie? - by Fröt on 02-11-2005 at 07:51 PM
RE: Help to a newbie? - by Plik on 02-11-2005 at 07:54 PM
RE: Help to a newbie? - by Fröt on 02-11-2005 at 07:58 PM
RE: Help to a newbie? - by Plik on 02-11-2005 at 08:02 PM
RE: Help to a newbie? - by Fröt on 02-11-2005 at 08:07 PM
RE: Help to a newbie? - by Plik on 02-11-2005 at 08:12 PM
RE: Help to a newbie? - by Fröt on 02-11-2005 at 08:26 PM
RE: Help to a newbie? - by Jip on 02-11-2005 at 11:53 PM
RE: RE: Help to a newbie? - by Fröt on 02-12-2005 at 12:37 AM
RE: Help to a newbie? - by Plik on 02-12-2005 at 12:43 AM
RE: RE: Help to a newbie? - by Fröt on 02-12-2005 at 12:48 PM
RE: Help to a newbie? - by (CyBeRDuDe) on 02-12-2005 at 01:09 PM
RE: Help to a newbie? - by Fröt on 02-12-2005 at 01:22 PM
RE: Help to a newbie? - by taz030485 on 02-19-2005 at 12:38 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On