Da Gambas-it.org - Wikipedia.
|
|
Riga 1: |
Riga 1: |
− | Per conoscere con l'API di Glib-2.0 il numero di giorni posseduti da un mese, si farà uso della funzione esterna ''g_date_get_days_in_month()'' .
| + | #REDIRECT [[Conoscere_il_numero_di_giorni_posseduti_da_un_mese]] |
− | | |
− | | |
− | Mostriamo di seguito un esempio pratico:
| |
− | Library "libglib-2.0"
| |
− |
| |
− | <FONT Color=gray>' ''guint8 g_date_get_days_in_month (GDateMonth month, GDateYear year)''
| |
− | ' Returns the number of days in a month, taking leap years into account.''</font>
| |
− | Private Extern g_date_get_days_in_month(GDmonth As Integer, GDyear As Integer) As Byte
| |
− |
| |
− |
| |
− | '''Public''' Sub Main()
| |
− |
| |
− | Dim num As Byte
| |
− | Dim mese As String
| |
− | Dim mesi As String[] = [Null, "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno",
| |
− | "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"]
| |
− |
| |
− | mese = "Febbraio" <FONT Color=gray>' ''...oppure anche: mese = mesi[2]''</font>
| |
− |
| |
− | num = g_date_get_days_in_month(mesi.Find(mese), 2016)
| |
− |
| |
− | Print "Il mese di "; mese; " contiene "; num; " giorni."
| |
− |
| |
− | '''End'''
| |
Versione attuale delle 17:18, 21 set 2017