vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Formatting birthdate question (https://vborg.vbsupport.ru/showthread.php?t=67072)

Boofo 07-11-2004 06:34 PM

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. ;)

Modin 07-11-2004 11:30 PM

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])); 


Dark_Wizard 07-11-2004 11:31 PM

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']; 


Dark_Wizard 07-11-2004 11:33 PM

LOL...that had to be a second off...didn't know you were looking at it as well

Modin 07-11-2004 11:51 PM

lol :)

mktimefix eh... will have to look at that function ;)

Boofo 07-12-2004 12:38 PM

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?

Boofo 07-12-2004 12:40 PM

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. ;)

Dark_Wizard 07-12-2004 06:05 PM

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); 


Boofo 07-12-2004 07:13 PM

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()

Dark_Wizard 07-12-2004 09:00 PM

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); 



All times are GMT. The time now is 11:16 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01151 seconds
  • Memory Usage 1,787KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete