PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old January 22nd, 2013, 05:31 AM
VincentasG VincentasG is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 34 VincentasG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 42 m 5 sec
Reputation Power: 2
Birthday format identification

Hi,

I have a table in database that contains birthday column varchar()- i choose varchar
because ecoder could input birthday like

1. 1993-14-03
2. 1993-03-14
3. March 14
4. March 14,1993
5.etc....

Now my problem i want to detect what month is their birthday could some help me?

Reply With Quote
Old January 22nd, 2013, 11:59 AM
MatthewJ MatthewJ is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: May 2007
Location: Davenport, Iowa
Posts: 1,021 MatthewJ User rank is Lance Corporal (50 - 100 Reputation Level)MatthewJ User rank is Lance Corporal (50 - 100 Reputation Level)MatthewJ User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 6 Days 12 h 13 m 18 sec
Reputation Power: 9
Research strtotime(). It will allow you to convert the string to a unix timestamp. Then you can use the timestamp and date() to get the month.

Reply With Quote
Old January 23rd, 2013, 04:22 AM
VincentasG VincentasG is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 34 VincentasG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 42 m 5 sec
Reputation Power: 2
Thanks a lot

Reply With Quote
Old January 23rd, 2013, 02:12 PM
IAmALlama IAmALlama is offline
Me
Click here for more information
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 2,290 IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 11 h 27 m 17 sec
Reputation Power: 10
You will run into problems allowing any date format like that. What date is "02-01-1990"? Feb 1 or Jan 2? strtotime won't help you decide either, it will just assume the format based on most likely the system locale format or just assume m-d-y. It won't automagically read the persons mind and know if it is jan or feb. Ideally you would control the format they enter. Use dropdowns to collect the month, day and year separately and then you know each value to put the date into the format you expect and better yet use an actual date field in mysql for storage. then you can sort, do maths and change the format to whatever the user wants to see.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Birthday format identification


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap