Jump to content
Fivewin Brasil

Por uma data saber qual numero da semana dentro do mes


kapiaba

Recommended Posts


/*
Por uma data saber qual numero da semana dentro do mes - By DonDiego. Em dicas.
*/

#include "fivewin.ch"

Function main()

SET CENTURY ON
SET EPOCH TO YEAR( DATE() ) - 50
SET DATE BRITISH
SET DATE FORMAT "dd/mm/yyyy"

? SemanaMes( CTOD( "20/05/2015" ) ) // 4a. semana.

return nil

Function SemanaMes( data )

local n, retorno := 1

for n = 1 to val(subst(dtoc(data),1,2))

if UPPER(CDoW( ctod( strzero(n,2)+subst(dtoc(data),3,len(dtoc(data))-2) ) ))="SUNDAY"

retorno++

endif

next

return retorno

// FIM


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...