LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-14-2004, 11:22 PM   #1
mpgram
Member
 
Registered: Sep 2003
Location: Dallas TX
Distribution: Red Hat
Posts: 59

Rep: Reputation: 15
Converting the date (not timestamp)


Ok, here is the problem I am facing.

Using the /etc/shadow file, an account expires 12600. Now, I know that this is the number of days since 01/01/1970 until the account expires.

I am trying to write a php script that takes that number and translates it to the actual date (Jul-1-2004). Does anyone have any ideas? I am completely stumped. Even if its just an algorithim, its better than I can come up with.

Thanks in advance,

Mark
 
Old 04-14-2004, 11:37 PM   #2
bigredgiant1
Member
 
Registered: Aug 2003
Distribution: Redhat since 5.2, Gentoo
Posts: 43

Rep: Reputation: 15
I didn't quite understand the 12600 days since 1970, and how that is a dynamic date for account deletion, but here you go. You might have to add mktime() to $timestamp to make it dynamic.

Code:
<?php
// Change days into hours, then hours into minutes
// then minutes into seconds
// Thus the # of seconds since 1970
$timestamp = 12600 * 24 * 60 * 60;
echo date("M-j-Y", $timestamp);
?>

Last edited by bigredgiant1; 04-14-2004 at 11:39 PM.
 
Old 04-18-2004, 03:56 PM   #3
mpgram
Member
 
Registered: Sep 2003
Location: Dallas TX
Distribution: Red Hat
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks,

in a round about way, that worked!

Thanks for the help.
 
  


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
Timestamp Help jch02140 Linux - Newbie 7 03-17-2006 02:33 AM
Insert date and timestamp Into File name petenyce Linux - Newbie 9 10-13-2005 12:16 PM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM
adding date timestamp to filename markraem Solaris / OpenSolaris 2 11-17-2004 08:32 AM
lastlog date does not match system date? jcmj Linux - Networking 6 10-22-2002 12:09 PM

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

All times are GMT -5. The time now is 03:37 PM.

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