From owner-freebsd-questions@FreeBSD.ORG Fri Jun 20 05:39:20 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20B6737B41E; Fri, 20 Jun 2003 05:39:20 -0700 (PDT) Received: from ensim1.kuruption.net (kuruption.net [64.246.28.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAC1343F93; Fri, 20 Jun 2003 05:39:16 -0700 (PDT) (envelope-from raymond@sundland.com) Received: from kuruption.net (pcp03026213pcs.plnfld01.nj.comcast.net [68.85.62.182]) by ensim1.kuruption.net (8.11.6/8.11.6) with ESMTP id h5KCdAR00542; Fri, 20 Jun 2003 08:39:10 -0400 Received: by kuruption.net (Postfix, from userid 50) id 0DA228D9DF; Fri, 20 Jun 2003 08:39:00 -0400 (EDT) Received: from sundland.com (pcp03026106pcs.plnfld01.nj.comcast.net [68.85.62.75]) by kuruption.net (Postfix) with ESMTP id 9AF1E8D9C9; Fri, 20 Jun 2003 08:38:58 -0400 (EDT) Message-ID: <3EF30062.1060506@sundland.com> Date: Fri, 20 Jun 2003 08:38:58 -0400 From: "Raymond T. Sundland" User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Murat USTUNTAS References: <3EF2FFB6.5000706@bimel.com.tr> In-Reply-To: <3EF2FFB6.5000706@bimel.com.tr> X-Enigmail-Version: 0.74.3.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-3.7 required=5.0 tests=EMAIL_ATTRIBUTION,HOT_NASTY,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,SPAM_PHRASE_01_02,TO_BE_REMOVED_REPLY, USER_AGENT,USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG version=2.44 X-Spam-Level: cc: stable@freebsd.org cc: questions@freebsd.org Subject: Re: How can convert user expired days in human readable ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2003 12:39:20 -0000 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 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"