Get month and day names 
Author Message
 Get month and day names

The following code uses the EnumCalendarProc() function to get the names of
months and the days of the week.  It returns them in the default language.

$INCLUDE "WIN32API.INC"

GLOBAL i AS LONG
GLOBAL s AS STRING

FUNCTION EnumCalendarProc(c AS ASCIIZ) AS LONG
  s = c
END FUNCTION

FUNCTION PbMain() AS LONG

  PRINT "Month names"
  FOR i = 0 TO 11
    EnumCalendarInfo CODEPTR(EnumCalendarProc), %LOCALE_SYSTEM_DEFAULT, 1, %
CAL_SMONTHNAME1 + i
    PRINT "  "; s
  NEXT

  PRINT "Day names"
  FOR i = 0 TO 6
    EnumCalendarInfo CODEPTR(EnumCalendarProc), %LOCALE_SYSTEM_DEFAULT, 1, %
CAL_SDAYNAME1 + i
    PRINT "  ";s
  NEXT

END FUNCTION



Sun, 01 Feb 2004 01:27:44 GMT  
 Get month and day names
Dave,

What about this code?

#COMPILE EXE
#INCLUDE "WIN32API.INC"

FUNCTION PBMain() AS LONG
  DIM szCalName AS ASCIIZ * 32
  msg$ = "Day names in default language: " + $CRLF
  FOR day& = 42 TO 48
    GetLocaleInfo %LOCALE_USER_DEFAULT, day&, szCalName, SIZEOF(szCalName)
    msg$ = msg$ + szCalName + $CRLF
  NEXT
  msg$ = msg$ + $CRLF + "Month names in default language:" + $CRLF
  FOR month& = 56 TO 67
    GetLocaleInfo %LOCALE_USER_DEFAULT, month&, szCalName, SIZEOF(szCalName)
    msg$ = msg$ + szCalName + $CRLF
  NEXT
  MSGBOX msg$, 64, "Retrieving day & month names"
END FUNCTION

--
Egbert Zijlema
"Visit the Basic Guru pages"
http://www.basicguru.com/zijlema/

Quote:
> The following code uses the EnumCalendarProc() function to get the names
of
> months and the days of the week.  It returns them in the default language.

> $INCLUDE "WIN32API.INC"

> GLOBAL i AS LONG
> GLOBAL s AS STRING

> FUNCTION EnumCalendarProc(c AS ASCIIZ) AS LONG
>   s = c
> END FUNCTION

> FUNCTION PbMain() AS LONG

>   PRINT "Month names"
>   FOR i = 0 TO 11
>     EnumCalendarInfo CODEPTR(EnumCalendarProc), %LOCALE_SYSTEM_DEFAULT, 1,
%
> CAL_SMONTHNAME1 + i
>     PRINT "  "; s
>   NEXT

>   PRINT "Day names"
>   FOR i = 0 TO 6
>     EnumCalendarInfo CODEPTR(EnumCalendarProc), %LOCALE_SYSTEM_DEFAULT, 1,
%
> CAL_SDAYNAME1 + i
>     PRINT "  ";s
>   NEXT

> END FUNCTION



Mon, 02 Feb 2004 23:32:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. getting days in this month !

2. First day of the month

3. First day of the month in 2000

4. Working Days of a month

5. First day of the month next year

6. Here's a Fuction to Return Number of Week Days in a Month

7. How can I print only the month and day

8. 2000 is suggested when entering month and day in date field

9. Traducing Months and Days in CW2001

10. @D1 reverses days and months

11. Day/Month/Year

12. MOVE CORRESPONDING (Was: Re: Day, Month and Year Conversion)

 

 
Powered by phpBB® Forum Software