Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Steve Clay http://mrclay.org/

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

RecordSet to tab-separated values

Function TSV(rs)
	Dim field
	For Each field In rs.Fields
		TSV = TSV & field.Name & VBTab
	Next
	TSV = Left(TSV, Len(TSV) - 1) & vbCr & rs.GetString()
End Function


The rows are separated by vbCr ("\r" in most languages).
The first row is the field names.

Unix time

Function UnixTime(gmtHrsOffset)
	UnixTime = DateDiff("s", "1/1/1970 00:00:00", Now()) - (3600 * gmtHrsOffset)
End Function

Repsonse.Write(UnixTime(-5)) 'E.S.T.


Adding in the GMT offset allowed this to match PHP's time() function on a separate server.
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS