Re: Strings with leading zeros
| From: | Rasmus Lerdorf | Date: | Thu, 28 Dec 2000 21:23:16 +0000 |
| Subject: | Re: Strings with leading zeros | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32140@lists.php.net to get a copy of this message | ||
What is the field type? Is it an integer or a string in the database?
On Thu, 28 Dec 2000, Charlie Llewellin wrote:
> Hi,
>
> I have a field returned to me from a remote database, a 8-digit number,
> MMDDYYYY, which I split up to get a date to use in further calculations.
>
> This field mostly has a leading zero for months from Jan through September;
> despite explicitly setting the type to a string, if there is a leading zero
> everything goes wrong. For example, if the field is 01102001, substr($field,
> 0, 2) returns 29, and the whole field is 295937!
>
> This seems to be related to bug #5404, I think. Can anybody suggest a
> workaround so that I can get 01 thru 09 in as my month?
>
> Many thanks,
> Charlie
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>