LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   how to convert windows date and time to unix date and time (https://www.linuxquestions.org/questions/general-10/how-to-convert-windows-date-and-time-to-unix-date-and-time-630969/)

jitupatil_2007 03-27-2008 05:04 AM

how to convert windows date and time to unix date and time
 
hi friends i am a .net developer and i want to convert windows date and time to windows date and time can anybody help me out please its urgent..

indienick 03-27-2008 07:45 AM

What form does the Windows date take? mmddyyyhhmmss - or something of the like; as I highly doubt it references from the epoch (Jan 1, 1970).

Here's the Wikipedia article on UNIX time. Get on them regexes. :)

EDIT: I just re-read your post - going from Windows D&T to Windows D&T sure sounds like a daunting task; I wish you the best of luck with it. ;) *heheh* I assumed you meant Windows D&T to POSIX D&T.

jitupatil_2007 03-28-2008 01:25 AM

how to convert data and time to unix date and time
 
hey indienick i now how to convert the current date and time to unix timestamp i am doing this with C#.net and now i want to convert the dates which are given to me in a file .like this

start_date_time,ani,dialed_digits,actual_dur,rounded_dur_secs,cost
3/18/2008 0:00,22575444,92685702995,1411,1411,1.9275
3/18/2008 0:00,13127337788,524659671385,43,60,0.0675
3/18/2008 0:00,17133415611,524281857171,454,480,0.54
3/18/2008 0:00,--------------,523595243087,28,60,0.0675

now i need to read date and time in this format and convert it into linux time stamp so can you plz help me...

fineteen 03-28-2008 12:59 PM

i have no answer for that.. but u can find 1 on yahoo answer..


cheers

indienick 03-28-2008 06:24 PM

While I can't provide a language-specific answer (as I don't know C#), I can give you a general algorithm to follow (besides, where's the fun in it if I just give you the answer? :)):
Code:

1.  Initialize a counting variable.

2.  Parse the string (to get the numbers in between the '/', ':' and space.

3.  Convert all numbers to seconds, and add them to the counting variable.

It's a really simple algorithm...not to mention a really simple task.

jitupatil_2007 03-29-2008 03:39 AM

how to convert windows date and time to unix date and time
 
Quote:

Originally Posted by indienick (Post 3103583)
While I can't provide a language-specific answer (as I don't know C#), I can give you a general algorithm to follow (besides, where's the fun in it if I just give you the answer? :)):
Code:

1.  Initialize a counting variable.

2.  Parse the string (to get the numbers in between the '/', ':' and space.

3.  Convert all numbers to seconds, and add them to the counting variable.

It's a really simple algorithm...not to mention a really simple task.


well thanks for all your help i have developed the code in C#. and its working fine now but i really appreciated your help. thanks alot.

jitupatil_2007 03-29-2008 03:42 AM

hey fine teen thanks for your participation. I have developed the code and its working fine. but be sure to help me next time. thank you.

osor 03-29-2008 12:36 PM

I’m wondering how you did it (there must be an easier way than manually). Is there any equivalent of strptime() in C#?

sara.ilanit 03-31-2008 05:58 AM

.
 
Sorry.I don't know!


All times are GMT -5. The time now is 08:29 AM.