# Thread: How to convert to posix time

1. ## How to convert to posix time

I wish to know if it's possible to make unix time only from the following data:
Year
Month
Date
Hour
Minute
Seconds

If yes how ?
Plz note i wish to define my own variables for year ,month ,date ,etc.

If no , how to make my own time tuple using above information and some info from existing variables through time module .

Br,
Aloycasmir

2. ## Re: How to convert to posix time

It is possible. What you need to use is the 'datetime' module.

3. Mahesh , thanx for replying .

i'm aware that we can do it by using datetime module's datetime tuple .
But i wish to know how to make posix time with only information on 'year , month , date , hour , minute , second'
And all other info being unawailable .

How would i make unix with only those variables .
The situation is that I'm unaware of remaining variables .
Eg-
For now:
'2009 , 06 , 03 , 12 , 05 , 39' is data available .
How to get this into unix time .
If possible plz also give some samples wrt to the above info

Br,
Aloycasmir

4. ## Re: How to convert to posix time

Originally Posted by aloycasmir
For now:
'2009 , 06 , 03 , 12 , 05 , 39' is data available .
How to get this into unix time .
If possible plz also give some samples wrt to the above info
Code:
```import time
time.mktime((2009, 6, 3, 12, 5, 39, 0, 0, 0))```

5. Oh . Just that ?
That's simple .
Nonetheless , thanx a ton mahesh bro .

Btw Is that accurate sufficiently ?
To the minute level to current time ?

6. ## Re: How to convert to posix time

Originally Posted by aloycasmir
Btw Is that accurate sufficiently ?
To the minute level to current time ?
This is upto the seconds, (2009, 6, 3, 12, 5, 39) => 3:Jun:009 12H:5M:39S

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•