FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WD17] Convert Date from Unix
[WD17] Convert Date from Unix
Débuté par Gianni Spano, 23 avr. 2015 09:42 - 5 réponses
Connectez-vous…
Gianni Spano
#1
Posté le 23 avril 2015 - 09:42
Hello to all
I have a MySql database hosted on a Unix machine, created by an old programmer
who is working in our firm.
I'm able to access to this db and its tables and extract all the values stored on it.
But, i have a field called "call_date" definied as INT and i need to extract the date/time stored with this format.
Googling i found a Sql solution to see the correct date/time and i have to write:
SELECT FROM UNIX_TIME (call_date)
and the readeable date/time is shown.
I thought "IntegerToDate" was the solution, but i have an error during the execution.
Is there someone who can tell me how to obtain the converted date and time from this INT format??
Thanks in advance
Gianni
Signaler
0
0
Paulo Oliveira
#2
Posté le 23 avril 2015 - 10:23
if you can get the date/time with the select you mention why don't you use it to get the values you need?
did you try to execute that query using hQueryWithoutCorrection?
Signaler
0
0
Gianni Spano
#3
Posté le 23 avril 2015 - 12:38
Hi Paulo
Yes, i know what you say.
But, i'm reading records using Hreadseek and not doing a SELECT.
I was hoping there was a way to convert date from INT (unix) to real date/time format.
Thanks.
Gianni
Signaler
0
0
Paulo Oliveira
#4
Posté le 23 avril 2015 - 12:55
It looks like your int is the number of seconds since '1970-01-01 00:00:00' UTC
Add your int value to the seconds of a datetime variable with this value and check the results.
Signaler
0
0
Fabrice Harari
#5
Posté le 23 avril 2015 - 13:45
Hi Gianno,
sure there is.. just google unix time integer format and you'll ind all the information you need...
From a quick read, it looks like the integer is the number of seconds since 19700101...
Best regards
Signaler
0
0
Gianni Spano
#6
Posté le 24 avril 2015 - 09:02
Hi to all
Found the solution...
the basic formula is: (UniDateInt/86400)+25569+(1/24)
(1/24) is for Italian timezone
nDataInt is int=1423224000 dtDataOggi is DateTime dtDataOggi=(nDataInt/86400)+25569+(1/24) // it returns the date 06/02/2015 13:00:00
Thanks
Gianni
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte