I have a script which checks the time() and compares it with a another time, and if the time() now is past the trigger point (12 midday) then it should update the database.
My problem is finding a way of defining the unix timestamp for 12 midday. Is there a date function that I can use where I plug in (12,00) and it lets me know the unix timestamp for 12 midday on that day? If so then I can't seem to find it in the php manual.
Anyone got a clue how I might achieve this?
How to define 12pm everyday as UNIX timestamp?
Moderator: General Moderators
-
Matt Phelps
- Forum Commoner
- Posts: 82
- Joined: Fri Jun 14, 2002 2:05 pm
-
Matt Phelps
- Forum Commoner
- Posts: 82
- Joined: Fri Jun 14, 2002 2:05 pm
I may have answered my own question. Can I use....?
Code: Select all
<?php
$midday = mktime(12, 00);
?>- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
try
Code: Select all
<?
$midday = mktime(12, 0, 0, date("n"), date("j"), date("Y"));
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
That should work because the function will assume all the other arguments (such as month, day, year) are to be set as the current values.Matt Phelps wrote:I may have answered my own question. Can I use....?Code: Select all
<?php $midday = mktime(12, 00); ?>
You can easily do:
Code: Select all
<?php
$midday = mktime(12, 0);
echo date('d/m/Y H:i', $midday);
?>Mac
Last edited by twigletmac on Tue Mar 04, 2003 3:17 am, edited 1 time in total.
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact: