[ciapug] Re: I hate dates...
Mike Parks
ciapug@cialug.org
Mon, 31 Jan 2005 08:02:10 -0600
I use this to create a timestamp from a date
<?
$myDate = $date; # MM/DD/YYY
$nDate = explode("/",$myDate);
$return = mktime(0,0,0,$nDate[0],$nDate[1],$nDate[2]); #
mktime(HH,MM,SS,Month,Day,Year)
$timestamp = $return;
?>
To get a date from a timestamp should be more like
<?
$tDate = {$value};
$myDate = ($nDate/8600);
$return = date("Y-m-d", $myDate);
?>
Mike
----- Original Message -----
From: <ciapug-request@cialug.org>
To: <ciapug@cialug.org>
Sent: Sunday, January 30, 2005 6:25 AM
Subject: ciapug digest, Vol 1 #180 - 2 msgs
> Send ciapug mailing list submissions to
> ciapug@cialug.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://cialug.org/mailman/listinfo/ciapug
> or, via email, send a message with subject or body 'help' to
> ciapug-request@cialug.org
>
> You can reach the person managing the list at
> ciapug-admin@cialug.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ciapug digest..."
>
>
> Today's Topics:
>
> 1. Re: I hate dates... (Lathrop Preston)
> 2. Re: I hate dates... (Barry Von Ahsen)
>
> --__--__--
>
> Message: 1
> Date: Sat, 29 Jan 2005 10:54:15 -0600
> From: Lathrop Preston <laith@prestonfam.org>
> Organization: Preston Family
> To: ciapug@cialug.org
> Subject: Re: [ciapug] I hate dates...
> Reply-To: ciapug@cialug.org
>
> I may be missing something... but can't you just do this?
>
> $myTimestamp = {mysql value}
> $dArr = explode(' ',$myTimestamp);
> $theDate = $dArr[0];
>
> I think you are trying to feed the 1947 (before epoc) date to the php
> time/date related functions. the result will be odd.
>
> Lathrop
>
> Chris Hettinger wrote:
>> I need a reliable function that I can pass a MySQL time stamp like
>> (1978-07-03 00:00:00) and have it return to me only the date portion ...
>>
>> I wrote something that just splits the datestamp, ignores the time
>> portion and make a new date with the year, month, and day. I am however
>> getting some returning incorrect.
>>
>> Passed this: 1947-08-30 00:00:00
>> Got this: 1969-12-31
>>
>> I know there must be something wrong and I know that 1969 date indicates
>> that but I don't know what to do and it's been a really LONG week...
>>
>> Can anyone do a little hand-holding for a moment :-\
>>
>> -ch
>>
>> _______________________________________________
>> ciapug mailing list
>> ciapug@cialug.org
>> http://cialug.org/mailman/listinfo/ciapug
>
>
> --__--__--
>
> Message: 2
> Date: Sat, 29 Jan 2005 18:33:15 -0600
> From: Barry Von Ahsen <barry@vonahsen.com>
> To: ciapug@cialug.org
> Subject: Re: [ciapug] I hate dates...
> Reply-To: ciapug@cialug.org
>
> Chris Hettinger wrote:
>> I need a reliable function that I can pass a MySQL time stamp like
>> (1978-07-03 00:00:00) and have it return to me only the date portion ...
>>
>> I wrote something that just splits the datestamp, ignores the time
>> portion and make a new date with the year, month, and day. I am however
>> getting some returning incorrect.
>>
>> Passed this: 1947-08-30 00:00:00
>> Got this: 1969-12-31
>>
>> I know there must be something wrong and I know that 1969 date indicates
>> that but I don't know what to do and it's been a really LONG week...
>>
>> Can anyone do a little hand-holding for a moment :-\
>>
>
> try date("Y-m-d", strtotime($mysql_date_time));
>
> -barry
>
>
>
> --__--__--
>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>
>
> End of ciapug Digest