UNIX Timestamp Visual Basic 6
Time() Function
Since I started programming in PHP, after Visual Basic, I started to rely on some of the features available with PHP. One of those was the Time() function.Since I don't know of any function that does this in Visual basic, I made this "wrapper" function to calculate with less code.
While I know this works for Visual Basic 6 Enterprise Edition, I'm not sure about earlier versions of Visual Basic. Please comment with your findings.
I do not believe this works with .NET-based languages (Visual Studio 2003 through 2010).
Option Explicit
Dim DateTime As String
Private Function Time(ByVal DateTime As String)
Dim DateTime As String
Private Function Time(ByVal DateTime As String)
Time = DateDiff("s", "01/1/1970 12:00:00 AM", DateTime)
End FunctionUsing this function is relatively simple:
Private Sub Form_Load()
Form1.Caption = Time(Now)
End Sub
"Now" is a Visual Basic Constant that contains a current timestamp (like this: 12/04/2009 11:57:00 AM). This will return the current timestamp as Form1's caption property.
You can also insert any (properly formatted) time into this function and get a result. You may get an error using this function if you don't call it / pass variables correctly. I didn't error-check it so you can debug it easier during development.
Proper formats:
mm/dd/yy
mm/dd/yyyy
mm/dd/yyyy hh:mm:ss ap
Try out your specifc requirements, they may work.mm/dd/yyyy
mm/dd/yyyy hh:mm:ss ap
Thanks for reading, please leave a comment below if you liked this article
| Posted: Monday, December 21, 2009 at 4:26:56 AM |
| By: aXfojVkF |
| 7FqVhS a href"http:azauctlqcvlu.com"azauctlqcvlua, urlhttp:ylihqsttkizj.comylihqsttkizjurl, linkhttp:lgsniytzzdrs.comlgsniytzzdrslink, http:yvilbhcqysyd.com |
| Posted: Monday, January 4, 2010 at 10:56:00 PM |
| By: crxazuik |
| xnsuplfl http:izkurhwg.com edncakur jfbitrjj a href"http:zaajiokz.com"nhnjrkuja URLhttp:iffwenqu.comhzutpdipURL |
| Posted: Friday, February 19, 2010 at 10:26:18 AM |
| By: yhFvzplJRCOYQirl |
| CcatYx a href"http:vrtwtzzxrjxu.com"vrtwtzzxrjxua, urlhttp:idvixgvyrtjg.comidvixgvyrtjgurl, linkhttp:hkrtgwasfmpl.comhkrtgwasfmpllink, http:zneqwgxnqdtb.com |
| Posted: Thursday, February 25, 2010 at 8:23:17 AM |
| By: hqthciqkhl |
| bfcWxa a href"http:chhmhlwjrcbz.com"chhmhlwjrcbza, urlhttp:tfuvseairxhi.comtfuvseairxhiurl, linkhttp:opfnfmfphxpd.comopfnfmfphxpdlink, http:nsjnixviklkj.com |
My PDFs