Date: Fri, 20 Jun 2003 15:59:05 +0300 From: Murat USTUNTAS <ustuntas@bimel.com.tr> To: questions@freebsd.org Subject: Re: How can convert user expired days in human readable ? Message-ID: <3EF30519.1070309@bimel.com.tr> In-Reply-To: <3EF30062.1060506@sundland.com> References: <3EF2FFB6.5000706@bimel.com.tr> <3EF30062.1060506@sundland.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Danny Pansters write me the following message to conver time in python language: %python Python 2.2.3 (#1, Jun 5 2003, 12:59:25) [GCC 3.2.2 [FreeBSD] 20030205 (release)] on freebsd5 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.ctime(1064005200) 'Fri Sep 19 23:00:00 2003' This what you need? --Dan Thank you all for your answers.. :) Regards, Murat Ustuntas Raymond T. Sundland wrote: Within the master.passwd, the time is stored in seconds since the Epoch, and there are standard C and POSIX functions for converting this into any format you want. I don't know much about python, but within Perl you can use strftime() to convert the date. You would do something similar to: strftime("%D", localtime($unixtime)) where $unixtime is assigned to the value you pulled from the master.passwd file. The %D simply returns a MM/DD/YY format date. Check to see if Python has similar functions... they are POSIX compliant. Murat USTUNTAS wrote: Hello all, On my system, some users have expire day user settings. I write a (python) script then parse the: 7.th selection in the master.passwd blabla:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:1064005200:xxxx:xxxx:xxxx:xxxx How can I conver the number like 1064005200 to human readable date format ? Or, there is a way to collect the information from a command interactively ? Regards, Murat Ustuntas _______________________________________________ [1]freebsd-questions@freebsd.org mailing list [2]http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [3]"freebsd-questions-unsubscribe@freebsd.org" _______________________________________________ [4]freebsd-questions@freebsd.org mailing list [5]http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [6]"freebsd-questions-unsubscribe@freebsd.org" References 1. mailto:freebsd-questions@freebsd.org 2. http://lists.freebsd.org/mailman/listinfo/freebsd-questions 3. mailto:freebsd-questions-unsubscribe@freebsd.org 4. mailto:freebsd-questions@freebsd.org 5. http://lists.freebsd.org/mailman/listinfo/freebsd-questions 6. mailto:freebsd-questions-unsubscribe@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EF30519.1070309>