Author |
Message |
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Jan 05, 2003 11:13 am (21 years, 3 months ago) |
|
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. |
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Mon Jan 06, 2003 6:11 pm (21 years, 3 months ago) |
|
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... |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Mon Jan 06, 2003 7:14 pm (21 years, 3 months ago) |
|
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 |
|
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Mon Jan 06, 2003 7:15 pm (21 years, 3 months ago) |
|
heh...musta' missed that |
________________________________ It's turtles all the way down... |
|
|
|
GingerNinja
Guest
|
Posted:
Tue Jun 10, 2003 10:40 pm (20 years, 10 months ago) |
|
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? |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed Jun 11, 2003 8:22 am (20 years, 10 months ago) |
|
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. |
________________________________
|
|
|
|
Guest
|
Posted:
Thu Sep 11, 2003 3:18 am (20 years, 7 months ago) |
|
i'm sure a lot of people new to php would appreciate the source to your script though |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Thu Sep 11, 2003 4:26 pm (20 years, 7 months ago) |
|
Here you go, I'll give you the code because I'm feeling nice today
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> "'.$_GET['stamp'].'" 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"> </td></tr>
<tr><td colspan="2"><input type="submit" value="Convert to a timestamp" /></td></tr>
</table>
</tr></td>
</table>
</form>
<p>© 2003, <a href="http://www.4webhelp.net/">4WebHelp</a></p> |
Released under the GPL license |
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Thu Sep 11, 2003 7:45 pm (20 years, 7 months ago) |
|
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 ) |
________________________________ It's turtles all the way down... |
|
|
|
Guest
|
Posted:
Fri Sep 12, 2003 7:08 am (20 years, 7 months ago) |
|
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
Quote: | You have exceeded the number of registration attempts for this session. Please try again later. |
|
|
|
|
|
Darren
Team Member
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Fri Sep 12, 2003 8:14 am (20 years, 7 months ago) |
|
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. | |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Fri Sep 12, 2003 1:25 pm (20 years, 7 months ago) |
|
Let me know if you still have problems when you try again |
________________________________
|
|
|
|
|