LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 03-27-2008, 05:04 AM   #1
jitupatil_2007
LQ Newbie
 
Registered: Mar 2008
Posts: 0

Rep: Reputation: 0
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..
 
Old 03-27-2008, 07:45 AM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
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.

Last edited by indienick; 03-27-2008 at 07:48 AM. Reason: Oversight
 
Old 03-28-2008, 01:25 AM   #3
jitupatil_2007
LQ Newbie
 
Registered: Mar 2008
Posts: 0

Original Poster
Rep: Reputation: 0
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...
 
Old 03-28-2008, 12:59 PM   #4
fineteen
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
i have no answer for that.. but u can find 1 on yahoo answer..


cheers

Last edited by XavierP; 03-28-2008 at 01:13 PM. Reason: removed advertising - link had nothing to do with the post
 
Old 03-28-2008, 06:24 PM   #5
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
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.
 
Old 03-29-2008, 03:39 AM   #6
jitupatil_2007
LQ Newbie
 
Registered: Mar 2008
Posts: 0

Original Poster
Rep: Reputation: 0
how to convert windows date and time to unix date and time

Quote:
Originally Posted by indienick View Post
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.
 
Old 03-29-2008, 03:42 AM   #7
jitupatil_2007
LQ Newbie
 
Registered: Mar 2008
Posts: 0

Original Poster
Rep: Reputation: 0
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.
 
Old 03-29-2008, 12:36 PM   #8
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
I’m wondering how you did it (there must be an easier way than manually). Is there any equivalent of strptime() in C#?
 
Old 03-31-2008, 05:58 AM   #9
sara.ilanit
LQ Newbie
 
Registered: Mar 2008
Posts: 0

Rep: Reputation: 0
Red face .

Sorry.I don't know!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting system date and time affecting the clock and date on BIOS satimis Ubuntu 7 09-21-2007 08:02 AM
Convert Normal Date to Unix Time gbratig AIX 5 06-02-2007 03:46 PM
thunderbird puts time instead of date under 'date' header wabbalee Linux - Software 4 11-26-2006 04:58 AM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM
convert date time format given in string suchi_s Programming 6 01-10-2005 04:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration