4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Unix Timestamp Converter
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Jan 05, 2003 11:13 am (14 years, 10 months ago) Reply with QuoteBack to Top

The Unix Timestamp Converter has been modified. It now not only converts timestamps to dates, but also converts dates to timestamps.

Please let me know if you have any trouble using it.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Mon Jan 06, 2003 6:11 pm (14 years, 10 months ago) Reply with QuoteBack to Top

very nice! You can also use it to find out what day of the week a certain date was on...I entered my birthday, then entered the resulting timestamp..and what d'ya know, it was a sunday!

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Mon Jan 06, 2003 7:14 pm (14 years, 10 months ago) Reply with QuoteBack to Top

You don't even need to do that. Just enter your birthday in the date to timestamp zone, and you'll see the day of the week appear, like this:

Quote:
Date/Time translates to Timestamp

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Mon Jan 06, 2003 7:15 pm (14 years, 10 months ago) Reply with QuoteBack to Top

heh...musta' missed that Rolling Eyes

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
GingerNinja
Guest





PostPosted: Tue Jun 10, 2003 10:40 pm (14 years, 5 months ago) Reply with QuoteBack to Top

Would it be possible to use this tool to run a bulk job i.e. get it to query a text file of dates and output them into a new text file in UNIX time stamp format?
OfflineFind all posts by Anonymous
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Wed Jun 11, 2003 8:22 am (14 years, 5 months ago) Reply with QuoteBack to Top

Yes, as I've said before all this script does is use PHP's date functions. So it wouldn't be too difficult to write your own script.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Guest






PostPosted: Thu Sep 11, 2003 3:18 am (14 years, 2 months ago) Reply with QuoteBack to Top

i'm sure a lot of people new to php would appreciate the source to your script though Smile
OfflineFind all posts by Anonymous
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Thu Sep 11, 2003 4:26 pm (14 years, 2 months ago) Reply with QuoteBack to Top

Here you go, I'll give you the code because I'm feeling nice today Very Happy

Code:
<form name="stamp" method="get" action="timestamp.php">
<table width="100%" class="bodyline" cellpadding="3" cellspacing="1" border="0" class="bodyline">
<tr><td class="rowdel" style="height: 27px" align="center"><strong>Convert timestamps into dates:</strong></td></tr>
<tr><td class="row1" align="center">
<input type="hidden" name="action" value="stamp" />
<?

if ($_GET['action']=='stamp') {
  $date = gmdate('l\, F j\<\s\u\p\>S\<\/\s\u\p\> Y\, G:i:s', $_GET['stamp']);
  if ($date && isset($_GET['stamp'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #C0C0C0; padding: 5px; margin: 5px">'.$_GET['stamp'].' translates to <strong>'.$date.' (GMT)</strong></p>');
  }
  elseif (!isset($_GET['stamp'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> No timestamp was filled in.</p>');
  }
  else {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> &quot;'.$_GET['stamp'].'&quot; is not a valid timestamp.</p>');
  }
}

?>
Timestamp: <input type="text" name="stamp" value="<? echo $stamp; ?>" size="11" maxlength="11" /> <i>(example: 1010342461)</i>
<br /><br /><input type="submit" value="Convert to a date" />
</td></tr>
</table>
</form>

<form name="date" method="get" action="timestamp.php">
<table width="100%" class="bodyline" cellpadding="3" cellspacing="1" border="0" class="bodyline">
<tr><td class="rowdel" style="height: 27px" align="center"><strong>Convert dates into timestamps:</strong></td></tr>
<tr><td class="row1" align="center">
<input type="hidden" name="action" value="date" />
<?

if ($_GET['action']=='date') {
  $stamp = gmmktime($_GET['hour'],$_GET['minute'],$_GET['second'],$_GET['month'],$_GET['day'],$_GET['year']);
  $new_date = date('l\, F j\<\s\u\p\>S\<\/\s\u\p\> Y\, G:i:s', $stamp);
  if ($stamp && isset($_GET['hour']) && isset($_GET['minute']) && isset($_GET['second']) && isset($_GET['month']) && isset($_GET['day']) && isset($_GET['year'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #C0C0C0; padding: 5px; margin: 5px">'.$new_date.' (GMT) translates to <strong>'.$stamp.'</strong></p>');
  }
  elseif (!isset($_GET['day'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> Please fill in the day field.</p>');
  }
  elseif (!isset($_GET['month'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> Please fill in the month field.</p>');
  }
  elseif (!isset($_GET['year'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> Please fill in the year field.</p>');
  }
  elseif (!isset($_GET['hour'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> Please fill in the hour field.</p>');
  }
  elseif (!isset($_GET['minute'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> Please fill in the minute field.</p>');
  }
  elseif (!isset($_GET['second'])) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> Please fill in the second field.</p>');
  }
  elseif (!$stamp && $_GET['day']==01 && $_GET['month']==01 && $_GET['year']==1970 && $_GET['hour']==00 && $_GET['minute']==00 && $_GET['second']==00) {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #C0C0C0; padding: 5px; margin: 5px">'.$new_date.' (GMT) translates to <strong>0</strong></p>');
  } 
  else {
    echo ('<p style="border-style: dashed; border-width: 1px; border-color: #330066; background-color: #FC8E8E; padding: 5px; margin: 5px"><strong>Error:</strong> invalid date. Make sure you have filled in all fields in the correct format.</p>');
  }
}

?>
<table border="0" cellpadding="1" cellspacing="0">
<tr><td>Day: </td><td><input type="text" name="day" value="<? echo $_GET['day']; ?>" size="2" maxlength="2" /> <i>(01-31)</i></td></tr>
<tr><td>Month: </td><td><input type="text" name="month" value="<? echo $_GET['month']; ?>" size="2" maxlength="2" /> <i>(01-12)</i></td></tr>
<tr><td>Year: </td><td><input type="text" name="year" value="<? echo $_GET['year']; ?>" size="4" maxlength="4" /></td></tr>
<tr><td>Hour: </td><td><input type="text" name="hour" value="<? echo $_GET['hour']; ?>" size="2" maxlength="2" /> <i>(00-23)</i></td></tr>
<tr><td>Minute: </td><td><input type="text" name="minute" value="<? echo $_GET['minute']; ?>" size="2" maxlength="2" /> <i>(00-59)</i></td></tr>
<tr><td>Second: </td><td><input type="text" name="second" value="<? echo $_GET['second']; ?>" size="2" maxlength="2" /> <i>(00-59)</i></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2"><input type="submit" value="Convert to a timestamp" /></td></tr>
</table>
</tr></td>
</table>
</form>
<p>&copy; 2003, <a href="http://www.4webhelp.net/">4WebHelp</a></p>


Exclamation Released under the GPL license Exclamation

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Thu Sep 11, 2003 7:45 pm (14 years, 2 months ago) Reply with QuoteBack to Top

since it's a legal requirement that you get a copy of the licence with the code, here's a link to it:
http://www.gnu.org/copyleft/gpl.html

(I was gonna post it instead of linking, but it was waaay longer than I thought Smile)

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Guest






PostPosted: Fri Sep 12, 2003 7:08 am (14 years, 2 months ago) Reply with QuoteBack to Top

I wanted to register and say thanks but this software doesn't like me much lol

phpBB sure has one hell of an annoying sign-up system, i tried several times and am still not registered.

The reg code leaves a bit to be desired, for example your 0 and the O, no real indication of which one is which lol, anyway i'll try and register again later. As i seem to have made it mad Wink

Quote:
You have exceeded the number of registration attempts for this session. Please try again later.
OfflineFind all posts by Anonymous
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Fri Sep 12, 2003 8:14 am (14 years, 2 months ago) Reply with QuoteBack to Top

Guest wrote:
The reg code leaves a bit to be desired, for example your 0 and the O, no real indication of which one is which lol,


the small print wrote:
Enter the code exactly as you see it. The code is case sensitive and zero has a diagonal line through it.
Wink
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Fri Sep 12, 2003 1:25 pm (14 years, 2 months ago) Reply with QuoteBack to Top

Let me know if you still have problems when you try again Smile

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.078418 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme