Results 1 to 7 of 7

Thread: Not what I was expecting

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Feb 2009
    Location
    Zeist, Netherlands
    Posts
    178

    Default Re: Not what I was expecting

    Code:
    Function DateTimeToString Global DateTime dtInput String Param_sFormat Returns String
        String sDag sMaand sJaar sUur sMinuut sSeconde sMilliSeconde sFormat
        Move (DateGetYear (dtInput)) to sJaar
        Move (DateGetMonth (dtInput)) to sMaand
        Move (DateGetDay (dtInput)) to sDag
        Move (DateGetHour (dtInput)) to sUur
        Move (DateGetMinute (dtInput)) to sMinuut
        Move (DateGetSecond (dtInput)) to sSeconde
        Move (DateGetMillisecond (dtInput)) to sMilliSeconde
        
        If (num_arguments = 2) Move Param_sFormat to sFormat
        Else Move ('DD-MM-JJJJ uu:mm:ss') to sFormat
    
    
        Move (Right (('0000' - sJaar ),4)) to sJaar
        Move (Right (('00' - sMaand  ),2)) to sMaand
        Move (Right (('00' - sDag    ),2)) to sDag
        Move (Right (('00' - sUur    ),2)) to sUur
        Move (Right (('00' - sMinuut ),2)) to sMinuut
        Move (Right (('00' - sSeconde),2)) to sSeconde
        Move (Right (('000' - sMilliSeconde),3)) to sMilliSeconde
        
        // Engelse coderingen even naar nederlands omzetten. 
        If (sFormat contains 'EEJJ') Move (Replace ('EEJJ',sFormat,'JJJJ')) to sFormat  // Eeuw + Jaar
        If (sFormat contains 'CCYY') Move (Replace ('CCYY',sFormat,'JJJJ')) to sFormat  // Century + Year
        If (sFormat contains 'YYYY') Move (Replace ('YYYY',sFormat,'JJJJ')) to sFormat  // Year
        If (sFormat contains 'YY'  ) Move (Replace ('YY'  ,sFormat,'JJ'  )) to sFormat  // Year
        If (sFormat contains 'hh'  ) Move (Replace ('hh',sFormat,'uu'    )) to sFormat  // hour
        
        If (sFormat contains 'JJJJ') Move (Replace ('JJJJ',sFormat,sJaar)) to sFormat
        Else If (sFormat contains 'JJ') Move (Replace ('JJ',sFormat,(Left (sJaar,2)))) to sFormat
    
    
        Move (Replace ('DDDD',sFormat, (WeekDagNaamUitNummer (DateGetDayOfWeek (dtInput))))) to sFormat
        Move (Replace ('DDD', sFormat, (Left ((WeekDagNaamUitNummer (DateGetDayOfWeek (dtInput))),2)))) to sFormat
        Move (Replace ('MMMM',sFormat, (MaandNaam (sMaand)))) to sFormat
        Move (Replace ('MMM', sFormat, (MaandNaamKort (sMaand)))) to sFormat
        Move (Replace ('MM',sFormat,sMaand)) to sFormat
        Move (Replace ('DD',sFormat,sDag)) to sFormat
        Move (Replace ('uu',sFormat,sUur)) to sFormat
        Move (Replace ('mm',sFormat,sMinuut)) to sFormat
        Move (Replace ('ss',sFormat,sSeconde)) to sFormat
        Move (Replace ('nnn',sFormat,sMilliSeconde)) to sFormat
    
    
        Function_Return sFormat
    
    
    End_Function
    
    Function WeekDagNaamUitNummer Global Integer iDag Returns String
        If (iDag = 1) Function_Return "Zondag"
        If (iDag = 2) Function_Return "Maandag"
        If (iDag = 3) Function_Return "Dinsdag"
        If (iDag = 4) Function_Return "Woensdag"
        If (iDag = 5) Function_Return "Donderdag"
        If (iDag = 6) Function_Return "Vrijdag"
        If (iDag = 7) Function_Return "Zaterdag"
        Function_Return ''
    End_Function
    
    Function MaandNaam Global ;
        Integer iMaand ;
        Returns String
    
    
        If (iMaand =  1) Function_Return 'Januari'
        If (iMaand =  2) Function_Return 'Februari'
        If (iMaand =  3) Function_Return 'Maart'
        If (iMaand =  4) Function_Return 'April'
        If (iMaand =  5) Function_Return 'Mei'
        If (iMaand =  6) Function_Return 'Juni'
        If (iMaand =  7) Function_Return 'Juli'
        If (iMaand =  8) Function_Return 'Augustus'
        If (iMaand =  9) Function_Return 'September'
        If (iMaand = 10) Function_Return 'Oktober'
        If (iMaand = 11) Function_Return 'November'
        If (iMaand = 12) Function_Return 'December'
        
        Function_Return 'onbekend'
    End_Function
    
    
    Move (DateTimeToString (dtDate, 'DDDD D MMMM JJJJ')) to sTest
    // sTest = Maandag 2 oktober 2023
    Regards.
    Last edited by IJmert; 4-Oct-2023 at 09:04 AM.
    I you create laws that are only interpretable by computers you get ruled by a computer...!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •