PC Review


Reply
Thread Tools Rate Thread

DateTime in unix format

 
 
=?Utf-8?B?UGhpbGlwIFdhZ2VuYWFy?=
Guest
Posts: n/a
 
      19th Aug 2005
I need to convert a datetime to unixstyle datetime, in other words the number
of seconds since 1-1-1970.

Do I have to calculate this myself using the ticks, or does the BCL provide
an easier way for this?
 
Reply With Quote
 
 
 
 
Mythran
Guest
Posts: n/a
 
      19th Aug 2005

"Philip Wagenaar" <(E-Mail Removed)> wrote in message
news:F24299D5-2F8E-4EFA-B3DD-(E-Mail Removed)...
>I need to convert a datetime to unixstyle datetime, in other words the
>number
> of seconds since 1-1-1970.
>
> Do I have to calculate this myself using the ticks, or does the BCL
> provide
> an easier way for this?


How about using the DateDiff function?

HTH,
Mythran

 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      19th Aug 2005
"Philip Wagenaar" <(E-Mail Removed)> schrieb
> I need to convert a datetime to unixstyle datetime, in other words
> the number of seconds since 1-1-1970.
>
> Do I have to calculate this myself using the ticks, or does the BCL
> provide an easier way for this?



dim diff as double

diff = yourdate.subtract(#1/1/1970#).totalseconds



Armin
 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      19th Aug 2005
Philip,

Do you mean something as this

MessageBox.Show(CType(Now.Subtract(New System.DateTime(1970, 1, 1)),
TimeSpan).TotalSeconds.ToString)

I hope this helps,

Cor


 
Reply With Quote
 
=?Utf-8?B?UGhpbGlwIFdhZ2VuYWFy?=
Guest
Posts: n/a
 
      19th Aug 2005
thank you all for your information

"Cor Ligthert [MVP]" wrote:

> Philip,
>
> Do you mean something as this
>
> MessageBox.Show(CType(Now.Subtract(New System.DateTime(1970, 1, 1)),
> TimeSpan).TotalSeconds.ToString)
>
> I hope this helps,
>
> Cor
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help w/conversion to Unix Epoch DateTime in code Tony! Microsoft C# .NET 3 6th Apr 2009 01:40 AM
DateTime problem: how to create datetime format hh:mm:ss AM/PM without the date mimi Microsoft C# .NET 1 6th Aug 2004 08:28 PM
converting Unix datetime count to .Net DateTime object Mark Worrall Microsoft Dot NET Framework 2 13th Feb 2004 05:52 PM
Re: converting Unix datetime count to .Net DateTime object Mark Worrall Microsoft C# .NET 1 4th Feb 2004 07:29 AM
converting Unix datetime count to .Net DateTime object Mark Worrall Microsoft Dot NET 1 4th Feb 2004 06:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:58 AM.