Archive for maggio 13th, 2009
13
mag

Per ricavare l’indirizzo IP del client che si collega ad una nostra pagina web realizzata in PHP si possono usare le seguenti righe di codice:

$ip_address = getenv('REMOTE_ADDR');

Oppure

$ip_address = $_SERVER['REMOTE_ADDR'];

13
mag

Torniamo sulla questione delle date in JAVA e vediamo come estrarre il giorno da una data:

public String getGiorno(Date d) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String giorno = sdf.format(d);
return giorno;
}
catch (Exception e) {
e.printStackTrace();
return "";
}
}

,