NYCPHP Meetup

NYPHP.org

mktime

Sexton, David David.SextonJr at ubs.com
Wed Jun 11 13:23:02 EDT 2003


Hi all,
 
I've run into an issue. Supposedly the mktime function will return a UNIX
timestamp while factoring in the timezone offset on the host machine (I
assume this because there is a gmmktime function as well for passing GMT
dates).
 
Anyways, I have written a function that calculates trade dates. I am
currently reproducing the function in VB, and I noticed that the timestamp
returned by PHP's mktime function is 5 hours ahead of the timestamp returned
in VB.
 
The other thing is that I then use the PHP date function to create a
formatted date using the UNIX timestamp returned by mktime. This date seems
to be correct, and the function is working as designed. So my second
question is: If mktime is not factoring the time zone offset on my host, is
the date function compensating for it and returning the correct trade date?
 
Anyone have any insight? Thanks!
==============================
Here's some code:
 
PHP sample:
 
$month = 12;
$day = 26;
$year = 2003;
$hours = 17;
$minutes = 0;
 
$secval =
mktime(intval($hours),intval($minutes),0,intval($month),intval($day),intval(
$year));
 
PRINT $secval; //----->(Returns 1072476000)
==============================
VB sample
 
month = 12
day = 26
year = 2003
hours = 17
minutes = 0
 
strDateFormat = month & "/" & day & "/" & year & " " & hours & ":" & minutes
secval = DateDiff("s", "1/1/1970", strDateFormat)
 
MsgBox secval '----->(Returns 1072458000)


****************************************************************************

Please do not transmit orders and/or instructions regarding a UBS Financial
Services Inc. or UBS International Inc. account by email. Unfortunately,
orders and/or instructions transmitted by email cannot be accepted by UBS
Financial Services Inc. or UBS International Inc., and UBS Financial Inc.,
and UBS International Inc. will not be responsible for carrying out such
orders and/or instructions.  Please speak directly with a UBS representative
to place an order.

************************************************************************

For your protection, do not include account numbers, social security
numbers, credit card numbers, passwords, or other non-public information in
your email.  

************************************************************************

The information provided in this email or any attachments is not an official
transaction confirmation or account statement. The only official
confirmation of a transaction will be sent to you via regular mail or be
posted online for your viewing if you have an Online Services account.

************************************************************************

UBS Financial Services Inc. and UBS International Inc. reserve the right to
monitor and review the content of all email communications sent or received
by employees.

************************************************************************

The information contained in this message may be privileged and confidential
and protected from disclosure.  If the reader of this message is not the
intended recipient, or an employee or agent responsible for delivering this
message to the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify
UBS immediately by replying to the message and deleting it from your
computer. Thank you.





More information about the talk mailing list