Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Access > Sécurité
Sécurité Le forum qui s'occupe de votre préoccupation de sécuriser l'accès à votre application Access, ainsi qu'à la sécurité des données.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/10/2011, 21h12   #1
Invité de passage
 
Homme
Développeur informatique
Inscription : octobre 2011
Messages : 1
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur informatique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : octobre 2011
Messages : 1
Points : 0
Points : 0
Par défaut Utiliser la date internet

Bonjour
Sur une application vba access, j'ai besoin de la date du jour et je ne souhaite pas utiliser la date du systeme : Date()
Comment faire pour lire la date du jour depuis internet plutot que d'utiliser la date du systeme ?
La date système peut être contournée alors que celle d'un site web non...
Merci pour votre aide.
NIQSE
NIQSE est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/10/2011, 03h02   #2
Expert Confirmé
 
Avatar de vodiem
 
Homme Diem VO
Vivre
Inscription : avril 2006
Messages : 2 644
Détails du profil
Informations personnelles :
Nom : Homme Diem VO
Âge : 40
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Vivre
Secteur : Conseil

Informations forums :
Inscription : avril 2006
Messages : 2 644
Points : 3 895
Points : 3 895
Salut NIQSE et bienvenu,

dans un module à part:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Option Explicit
 
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetOpenUrl Lib "wininet.dll" Alias "InternetOpenUrlA" (ByVal hOpen As Long, ByVal sUrl As String, ByVal sHeaders As String, ByVal lLength As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
 
Private Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Private Const INTERNET_FLAG_RELOAD = &H80000000
 
Function GetUTC() As Date
 
    Dim hOpen As Long
    Dim hOpenUrl As Long
    Dim bDoLoop As Boolean
    Dim bRet As Boolean
    Dim sReadBuffer As String * 2048
    Dim lNumberOfBytesRead As Long
    Dim sBuffer As String
    Dim rech As String
    Dim posd As Long
    Dim posf As Long
 
    Const scUserAgent = "VB Project"
    Const sUrl = "http://www.timeanddate.com/worldclock/city.html?n=195"
 
    hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
    hOpenUrl = InternetOpenUrl(hOpen, sUrl, vbNullString, 0, INTERNET_FLAG_RELOAD, 0)
 
    bDoLoop = True
    Do While bDoLoop
        sReadBuffer = vbNullString
        bRet = InternetReadFile(hOpenUrl, sReadBuffer, Len(sReadBuffer), lNumberOfBytesRead)
        sBuffer = sBuffer & Left$(sReadBuffer, lNumberOfBytesRead)
 
        If Not CBool(lNumberOfBytesRead) Then
            bDoLoop = False
        End If
    Loop
 
    If hOpenUrl <> 0 Then InternetCloseHandle (hOpenUrl)
    If hOpen <> 0 Then InternetCloseHandle (hOpen)
 
    rech = "<strong id=ctu>"
    posd = InStr(InStr(sBuffer, rech) + Len(rech), sBuffer, " "): posf = InStr(posd, sBuffer, "<")
    sBuffer = Mid(sBuffer, posd, posf - posd)
    sBuffer = Replace(sBuffer, ",", ""): sBuffer = Replace(sBuffer, " h ", ":"): sBuffer = Replace(sBuffer, " m ", ":")
    GetUTC = CDate(sBuffer)
 
End Function
GetUTC() te renvoie en format date l'UTC du site timeanddate.com
pour Paris il faut rajouter 2h.

vodiem est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/10/2011, 01h24   #3
Membre confirmé
 
Homme
Développeur amateur
Inscription : mars 2009
Messages : 176
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Maroc

Informations professionnelles :
Activité : Développeur amateur

Informations forums :
Inscription : mars 2009
Messages : 176
Points : 255
Points : 255
Bonsoir,

Récupérer le temps à partir d'un serveur situé dans le meme réseau peut être egalement interéssant. Voici un lien sur comment faire:
http://www.developpez.net/forums/d91...steme-serveur/

Cordialement
reedy est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 19h51.


 
 
 
 
Partenaires

Hébergement Web