473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Problem with converting number to date

I am taking yyyy,mm,dd from difrent select boxes.
while i concatinate this using following code.
$dob=$doby.$dobm.$dobd; /it gives as yyyymmdd/
but i want it in format yyyy-mm-dd
i have tried this
$dob=implode('-', array($doby, $dobm, $dobd));but it subtracts 3 numbers(ie. 2000-10-10 = 2080)
I want it as 2000-10-10 to insert into DataBase
Aug 7 '13 #1
2 1143
Rabbit
12,516 Expert Mod 8TB
You already know how to concatenate so you just need to concatenate the dash characters.
Expand|Select|Wrap|Line Numbers
  1. $dob=$doby.'-'.$dobm.'-'.$dobd;
Aug 7 '13 #2
Dormilich
8,658 Expert Mod 8TB
i have tried this
$dob=implode('-', array($doby, $dobm, $dobd)); but it subtracts 3 numbers (ie. 2000-10-10 = 2080)
then you most probably did not use quotes in the query. hence SQL sees an expression and evaluates it. (btw. 2000-10-10 = 1980)
Aug 8 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sven Mayer | last post by:
Assume a database (e.g. Oracle) field is declared as a) NUMBER (length=10) b) NUMBER (length=26) c) VARCHAR2 (length=1) d) VARCHAR2 (length=50) e) DATE How do I retrieve the contents from...
2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
1
by: H. Kaya | last post by:
Hallo, I have a problem converting a XML file to a other. I have no idea how I can do this. I try it for a long time but I can not find a solution. Has anyone a Idea? Below you can find my...
3
by: Jim | last post by:
I'm having a problem with a date query..im trying to pull customer data based on a date specified from a form to 3 months prior to the date specified. So lets say in the form I specified 1/2/2004....
1
by: Liviu BURCUSEL | last post by:
Hello ! It is late night and I cannot think right anymore. Please help me to convert a interval like '2 days 00:22:10.2905' in seconds. Thank you very much in advance, Liviu ...
3
by: spdude | last post by:
I am working on an application that stores date in DOS format. For ex: 9540 which appears to be the number of days since 1980. Anyone knows a way to convert this into the mmddyyyy format? Thanks...
12
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for...
2
by: savigliano | last post by:
hello, i am doing a date comparation and i have reallize that the data i have in my database (general date format) it is causing me problems, and because i donīt need the time data i would like to...
0
by: coolvivek33 | last post by:
hi i am facing a strange problem i am trying to build report using sql server 2005 and microsoft visual studio2005 now it is in requirement that i should seperate date from time.I have done that...
1
by: Rehana | last post by:
I am having problem,while inserting date using insert query...In front end am using c#.net and my database is in ms-access.. if am pass date in dd/mm/yy format in insert query..it store as mm/dd/yy...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.