VB icon

Unix TimeStamp Dword32 Convert

Email
Submitted on: 1/3/2020 4:17:33 AM
By: Thmsz23 
Level: Advanced
User Rating: Unrated
Compatibility: VB 5.0, VB 6.0
Views: 1775
author picture
 
     Number dword (UNIX TimeStamp) convert to standard format time & date. Include fix error number 6 (overflow) when entering a larger date as 2038/19/01 aka "Y2K38" "Y2K+38" "Y2.038K" and constantly adheres to dword format. The 32bit value is used from a negative number. Have a nice day :: RIDENTEM DICERE VERUM QUID VETAT? ::
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Unix TimeStamp Dword32 Convert 
' Description:Number dword (UNIX TimeStamp) convert to standard format time & date. 
Include fix error number 6 (overflow) when entering a larger date as 2038/19/01 aka "Y2K38" "Y2K+38" "Y2.038K" and constantly adheres to dword format. The 32bit value is used from a negative number. Have a nice day
:: RIDENTEM DICERE VERUM QUID VETAT? ::
' By: Thmsz23
'**************************************

Option Explicit
Private Function Date2UnixDword(ByVal Zadej_DATETIME As String) As String
Dim temp As String
temp = Zadej_DATETIME
If temp > "19.01.2038 03:14:07" Then
Date2UnixDword = DateDiff("s", "19.01.2038 03:14:07", temp) Or &H80000000
Else
Date2UnixDword = DateDiff("s", "01.01.1970 00:00:00", temp)
End If
Date2UnixDword = Format$(Date2UnixDword, "0000000000")
End Function
Private Function UnixDword2Date(ByVal Zadej_DWORD As Long) As String
Dim temp As Double
temp = CDbl(Zadej_DWORD And &H7FFFFFFF)
If Zadej_DWORD < 0 Then
UnixDword2Date = DateAdd("s", temp, "19.01.2038 03:14:07")
Else
UnixDword2Date = Format$(DateAdd("s", temp, "01.01.1970 00:00:00"), "dd.mm.yyyy hh:mm:ss")
End If
End Function
Private Sub cmdDecode_Click()
With Me
.txtText4.Text = UnixDword2Date(.txtText1.Text)
End With
End Sub
Private Sub cmdCode_Click()
With Me
.txtText2.Text = Date2UnixDword(.txtText4.Text)
End With
End Sub


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.