Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2004, 06:34 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Formatting birthdate question

Can someone please tell me how to make this:

Quote:
01-31-54
into this:

Quote:
January 31, 1954
with the following line?

PHP Code:
$birthdate=$bbuserinfo['birthday']; 
I tried doing the vbdate($vboptions['dateformat'] string, but it gives me Dec, 31st, 1969 for anything before 1970. I know this is fixed in vB3, but for some reason it isn't working for that line. I am using this in a file for realchat to pass paranmeters to the chat program. This is the only thing I have that is not working the way I want it to.

Thank you in advance.
Reply With Quote
  #2  
Old 07-11-2004, 11:30 PM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this Boofo...
PHP Code:
$birthdate_parts explode("-"$bbuserinfo['birthday']);
$birthday date("F j, Y"mktime(000$birthdate_parts[0], $birthdate_parts[1], $birthdate_parts[3])); 
Reply With Quote
  #3  
Old 07-11-2004, 11:31 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:

PHP Code:
$bday explode('-'$bbuserinfo['birthday']);
    if (
date('Y') > $bday[2] AND $bday[2] > 1901 AND $bday[2] != '0000')
    {
        require_once(
'./includes/functions_misc.php');
        
$vboptions['calformat1'] = mktimefix($vboptions['calformat1'], $bday[2]);
        
$bbuserinfo['birthday'] = vbdate($vboptions['calformat1'], mktime(000$bday[0], $bday[1], 1992), falsetruefalse);
    }
    else
    {
        
$bbuserinfo['birthday'] = vbdate($vboptions['calformat2'], mktime(000$bday[0], $bday[1], 1992), falsetruefalse);
    }
$birthdate $bbuserinfo['birthday']; 
Reply With Quote
  #4  
Old 07-11-2004, 11:33 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LOL...that had to be a second off...didn't know you were looking at it as well
Reply With Quote
  #5  
Old 07-11-2004, 11:51 PM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol

mktimefix eh... will have to look at that function
Reply With Quote
  #6  
Old 07-12-2004, 12:38 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dark_Wizard
Try this:

PHP Code:
$bday explode('-'$bbuserinfo['birthday']);
    if (
date('Y') > $bday[2] AND $bday[2] > 1901 AND $bday[2] != '0000')
    {
        require_once(
'./includes/functions_misc.php');
        
$vboptions['calformat1'] = mktimefix($vboptions['calformat1'], $bday[2]);
        
$bbuserinfo['birthday'] = vbdate($vboptions['calformat1'], mktime(000$bday[0], $bday[1], 1992), falsetruefalse);
    }
    else
    {
        
$bbuserinfo['birthday'] = vbdate($vboptions['calformat2'], mktime(000$bday[0], $bday[1], 1992), falsetruefalse);
    }
$birthdate $bbuserinfo['birthday']; 
That worked like a charm, thank you, sir.

One last thing, if I want to strip the DAY out of that string, how could I do that? I use

l, FjS, Y

for the birthdays on my board, but in this program I only want

F j, Y

Can this be done?
Reply With Quote
  #7  
Old 07-12-2004, 12:40 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Modin
Try this Boofo...
PHP Code:
$birthdate_parts explode("-"$bbuserinfo['birthday']);
$birthday date("F j, Y"mktime(000$birthdate_parts[0], $birthdate_parts[1], $birthdate_parts[3])); 
Thank you, sir. Your code worked great for the day but it showed 2000 for my birth year, which is just a little off. But you were a heck of a lot closer than I have been able to get.
Reply With Quote
  #8  
Old 07-12-2004, 06:05 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
That worked like a charm, thank you, sir.

One last thing, if I want to strip the DAY out of that string, how could I do that? I use

l, FjS, Y

for the birthdays on my board, but in this program I only want

F j, Y

Can this be done?
Change this:
PHP Code:
$bbuserinfo['birthday'] = vbdate($vboptions['calformat1'], mktime(000$bday[0], $bday[1], 1992), falsetruefalse); 
to this:
PHP Code:
$bbuserinfo['birthday'] = date('F j, Y'mktime(000$bday[0], $bday[1], 1992), falsetruefalse); 
Reply With Quote
  #9  
Old 07-12-2004, 07:13 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dark_Wizard
Change this:
PHP Code:
$bbuserinfo['birthday'] = vbdate($vboptions['calformat1'], mktime(000$bday[0], $bday[1], 1992), falsetruefalse); 
to this:
PHP Code:
$bbuserinfo['birthday'] = date('F j, Y'mktime(000$bday[0], $bday[1], 1992), falsetruefalse); 
I get this error with the change:

Quote:
Wrong parameter count for date()
Reply With Quote
  #10  
Old 07-12-2004, 09:00 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
I get this error with the change:
Oops...change it to this:
PHP Code:
$bbuserinfo['birthday'] = date("F j, Y"mktime(000$bday[0], $bday[1], 1992), falsetruefalse); 
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:43 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04623 seconds
  • Memory Usage 2,308KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (10)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete