Jump to content

[SOLVED] I had a book once...


Ryoku

Recommended Posts

don't use sprintf

 

php.net/date

 

will show u all the parameters to return various date items.

 

I actualy started on the php.net manual but its didn't help me with the problem of losing my formatting when i printed the results.

 

after i would explode() the date into an array to work with the numbers once i used any math on the values they lost their formatting.

 

if I'm going to transpose the base date into another value i need to know how to force the length of the string.

well this is the situation I'm in. I'm messing with functions I'd like to add to, my first, news script.

 

I either have the date provided by PHP from the date() or i have the date retrieved from the entries in my DB server.

 

I'd like the ability to post/pre-date news (to be posted) by adding or subtracting from the int date and still have it compatible with the date format of the DB server where it will end up. but when i attempt to script for pre/post any math i do to the value returns a value of a single digit not 2 digits as the DB formatting requires (to my knowledge)

 

i get 9 where i need 09 [since i did these tests today (08/09/08)]

well i think i figured out a way, using mkdate() to reformat the date, if i have an idate('Y') to just call the values and manipulate them that way i throw the values back into a date('Y-m-d',mktime(0,0,0,$curmonth,$curdate,$curyear)) i get the result I'm looking for...

 

^solved

 

although it still really dosen't answer my question of how to force a string length, how ever mute, =P i remember a tiny piece of the over all code to pull it off it looked something like this

 

[/./.\\/]

 

but that's all i remember and i have no idea what that example means...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.