PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



RE: Date as a single variable

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General
View previous topic :: View next topic  
Author Message
Tony Francis
Guest





PostPosted: Wed Feb 17, 1999 11:54 am    Post subject: Date as a single variable Reply with quote

O.K. - I admit defeat !!
There's obviously a way to do this, but I just can't figure it out.
What I have is a HTML form where the user inputs a whole heap of fields including a date.
What I am then doing is passing the data to a PHP3 file to process the sending of the data to an mSQL database.
What I can't figure out id how to get the date format as one expression instead of the 3 (day, month, year) that I have started with.
Be gentle with me - I'm just learning this stuff Smile
Any help would be gratefully appreciated and would also mean the few hairs I have remaining may last a while longer yet !!
Back to top
scollo
Guest





PostPosted: Wed Feb 17, 1999 4:44 pm    Post subject: RE: Date as a single variable Reply with quote

In PHP you can use the dot (.) operator to concatenate the values in the variables. So if you need the date in YYYY-MM-DD format, you can:

$date = $year . "-" . $month . "-" . $day;

This will create the string "YYYY-MM-DD".

Or, if you need MM/DD/YYYY, do the same thing:

$date = $month . "/" . $day . "/" . $year;

Then use "$date" in your SQL statement.

--Chris
Back to top
Tony Francis
Guest





PostPosted: Thu Feb 18, 1999 5:50 am    Post subject: RE: Date as a single variable Reply with quote

Thank you - did the trick perfectly, and saved me hours more time in trying to discover the solution.

Cheers
Back to top
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



PHP Code Examples
 Stream diffrent sizes of images from a single image to save disk space.
 JavaScript dropdown list menu to switch any page.
 Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
 PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
 Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
 Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
 A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum






Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum