PC Review


Reply
Thread Tools Rate Thread

How to Convert a date and time to epoch?

 
 
Extremest
Guest
Posts: n/a
 
      19th Jun 2006
I have a bunch of dates in a couple different formats. I would like to
convert them to epoch. The dates are like this

Mon, 12 Jun 2006 09:18:22 GMT
12 Jun 2006 10:37:28 GMT

I can do this in perl easily with the Date::Manip module but don't know
how to do it in c#. Is there a way to do this or do I need to right
something to parse each date?

 
Reply With Quote
 
 
 
 
hiteshmangal@gmail.com
Guest
Posts: n/a
 
      19th Jun 2006
Hi,

For that u can use DateTime class.

DateTime dt = new DateTime.Now;

By this u will get current date and time.

Thanks,
Hitesh





Extremest wrote:

> I have a bunch of dates in a couple different formats. I would like to
> convert them to epoch. The dates are like this
>
> Mon, 12 Jun 2006 09:18:22 GMT
> 12 Jun 2006 10:37:28 GMT
>
> I can do this in perl easily with the Date::Manip module but don't know
> how to do it in c#. Is there a way to do this or do I need to right
> something to parse each date?


 
Reply With Quote
 
Extremest
Guest
Posts: n/a
 
      19th Jun 2006
I don't need to do the current one. I need to do ones that are in the
above format. Is that possible?

 
Reply With Quote
 
Extremest
Guest
Posts: n/a
 
      19th Jun 2006
OK I figured it out. Used datetime.parse to get it formatted then used
a little function to get the epoch.

 
Reply With Quote
 
hiteshmangal@gmail.com
Guest
Posts: n/a
 
      19th Jun 2006
Hi,


For that u can use below line for getting UTC/GMT time:-

DateTime dt = DateTime.UtcNow;

Thanks,
Hitesh




Extremest wrote:

> OK I figured it out. Used datetime.parse to get it formatted then used
> a little function to get the epoch.


 
Reply With Quote
 
chanmm
Guest
Posts: n/a
 
      19th Jun 2006
Concatenate the string using whatever you find here:
http://msdn2.microsoft.com/en-us/library/8kb3ddd4(d=ide).aspx

chanmm

"Extremest" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a bunch of dates in a couple different formats. I would like to
> convert them to epoch. The dates are like this
>
> Mon, 12 Jun 2006 09:18:22 GMT
> 12 Jun 2006 10:37:28 GMT
>
> I can do this in perl easily with the Date::Manip module but don't know
> how to do it in c#. Is there a way to do this or do I need to right
> something to parse each date?
>



 
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
convert unix epoch seconds to yyyy:mm:dd in excel teamsiems Microsoft Excel Worksheet Functions 2 22nd Dec 2009 01:09 PM
convert EPOCH date =?Utf-8?B?TWlrZQ==?= Microsoft Access 3 6th Jan 2006 08:47 PM
Epoch Time Tom Microsoft Access VBA Modules 1 4th Jun 2004 10:15 PM
Converting epoch time to "date/time" MGFoster Microsoft Access Reports 7 3rd Feb 2004 04:29 PM
EPOCH Time Sunil Microsoft VB .NET 2 4th Sep 2003 05:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:43 AM.