Jump to content
  • 0

Converteer date & time naar unix time


pavabe

Question

Posted

Hoi,

 

Voor het exporteren van een bestand heb ik de unix time nodig.

Weet iemand hier een formule voor ?

Ik weet wel dat je moet gaan rekenen vanaf 1-1-1970 maar ik kom er niet uit. :?

 

Bedankt alvast

4 answers to this question

Recommended Posts

  • 0
Posted

De unix timestamp is het aantal seconden vanaf 1-1-1970 00:00. Met de Timestamp functie kun je dat in Filemaker als volgt berekenen:

 

DatumTijdVeld - Timestamp ( Date ( 1 ; 1 ; 1970 ) ; Time ( 0 ; 0 ; 0 ) )

 

DatumTijdVeld is daarbij een Timestamp veld, deze berekening heeft een getal als uitkomst...

  • 0
Posted

Wil je de Unix-timestamp van het huidige moment hebben, gebruik dan de formule:

Get ( CurrentTimeStamp ) - Timestamp ( Date ( 1 ; 1 ; 1970 ) ; Time ( 0 ; 0 ; 0 ) )

Zorg dat de calculatie unstored is ("storage options" bij de formule).

 

Op de layout krijg je in eerste instantie iets te zien als "1,1055e+09".

Wil je gewoon het getal zien, formateer op de layout het veld dan als "Leave data formatted as entered".

  • 0
Posted (edited)

If ( 
Date ( (Month (current_timestamp)); (Day (current_timestamp)); Year ((current_timestamp)) )  >=  (Date(1;1;1970))
and
Date ( (Month (current_timestamp)); (Day (current_timestamp)); Year ((current_timestamp)) ) <= (Date(7;8;2038));

(Seconds ( current_timestamp )) +
(Minute ( current_timestamp ) * 60) +
( (Hour (current_timestamp) - time_zone_offset) * 3600) +
((Date ( (Month (current_timestamp)); (Day (current_timestamp)); Year ((current_timestamp)) ) - (Date(1;1;1970))) * 86400)

;-1)

 

 

met dank aan :

http://www.briandunning.com/filemaker-custom-functions/list.php en scroll in de lijst naar de functie UnixDate.

Edited by Guest
  • 0
Posted

Hardstikke bedankt allemaal. :D

 

Met de bovenstaande formules is het me gelukt.

 

Ik heb de volgende formule gebruikt om de unix time te krijgen.

 

Timestamp (Datum;Tijd) - Date ( 1 ; 1 ; 1970 ) waarbij het resultaat een nummer is.

 

En datum en tijd zijn de invoer velden met hun type date & time.

 

nogmaals bedankt

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...