I need help generating a timestamp the same way you generate one in flash (actionscript)

new Date().getTime()

That's how you generate it in actionscript, it returns a 13 character int. eg 1202497647515

Dim date1970 As Date = "#1/1/1970 12:00:00 AM#"
Dim datenow As Date = Date.Now

days = DateDiff(DateInterval.Second, date1970, datenow)

With VB.net it returns a 10 character int. eg 1202497717


How can I make the vb one the same as the actionscript one by only editing the vb?

Recommended Answers

All 6 Replies

I need help generating a timestamp the same way you generate one in flash (actionscript)

new Date().getTime()

That's how you generate it in actionscript, it returns a 13 character int. eg 1202497647515

Dim date1970 As Date = "#1/1/1970 12:00:00 AM#"
Dim datenow As Date = Date.Now

days = DateDiff(DateInterval.Second, date1970, datenow)

With VB.net it returns a 10 character int. eg 1202497717


How can I make the vb one the same as the actionscript one by only editing the vb?

you can use the Format(Now"MMDDYYYYhhmmss") this will result in 02192008114618 as your DateDiff result

Thank you for the reply, however that doesn't generate it in the same formate that flash does (javascript also generates it the same)

The code you gave returns
02202008095054

The actionscript returns
1203501047328

Which according to the actionscript documentation is the number of milliseconds from midnight January 1, 1970

The best I can get with vb.net is

VB.net
1203501350

Actionscript
1203501350515

Its almost there but actionscript seems to get 3 extra digits from somewhere, It's driving me insane.

Thank you for the reply, however that doesn't generate it in the same formate that flash does (javascript also generates it the same)

The code you gave returns
02202008095054

The actionscript returns
1203501047328

Which according to the actionscript documentation is the number of milliseconds from midnight January 1, 1970

The best I can get with vb.net is

VB.net
1203501350

Actionscript
1203501350515

Its almost there but actionscript seems to get 3 extra digits from somewhere, It's driving me insane.

Steven, if you take away the ss on the end, it will give you 12 digiits, to the minute. I added the addition of the seconds.

Thanks for your help but that's not giving the correct value.

The actionscript returns the number of milliseconds from jan 1st 1970 to 13 digits.

You code just gives me the date but formatted without any spaces or symbols and not a timestamp.

Try this:
DateTime.UtcNow.Subtract(#1/1/1970#).TotalMilliseconds()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.