Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date as a number. 1

Status
Not open for further replies.

denimined

Programmer
Sep 29, 2004
54
CA
Hi all.

In the process of converting VB6 code to .NET, I have run into a date problem. What I want is the DATE value as a number.
For example, in VB6 CLng(Now) [for today] returns 41262. [Tomorrow it will be 41263.]

Any help would be greatly appreciated.

Alternatively, is there a way to get a unique file name? The DATE as LONG requirement is simply part of a function that converts the current date (as a number) to a 3 digit base 36 number and then the time [hhmmss] to a 4 digit base 36 number giving a unique 7 character file name that will never be repeated past the second. [Base 36 --> 0-9 & A-Z, hence you get results like VM82KM4.]
 

Use the Date.ToOADate function. For example, the following:

Date.Today.ToOADate

returns 41262, just as you require.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top