Add to Favorites
Hosting Discussion
 

forgot password?


Reply


Old
  Post #1 (permalink)   10-01-2004, 05:26 PM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Hey guys,
I am a newbie and I need some help - I will be deeply grateful to all that can help me.
The problem is the following - I have a form, which retrieves automatically date from MySQL cell. The problem is, that the date is being retrieved in MySQL's standart format - yyyy-mm-dd. And I want the date to be retrieved dd/mm/yyyy. Can you help?
Thanks in advance!
 
 
 


Old
  Post #2 (permalink)   10-02-2004, 10:17 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
It would be easier if you posted the script or php file that is displaying the date, as it would be difficult to know exactly how the date is being called or how it is stored in the database.

If possible, check the database, to see what the data looks like for the date value, it would be easier to answer you then as well.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #3 (permalink)   10-04-2004, 06:28 AM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Dear ANMMark,
I'll try to do this - although I'm not sure if I will manage to.
The data is entered through a hidden field. The script for entering the date is:

<input name="date_msg" type="hidden" id="date_msg" value="<?php echo date('Y/m/d'); ?>">

The date then is substracted from the table with the following script:

<?php echo $row_rsAnn['anDate']; ?>

I don't know if this helps - I might not be explaining it properly.
It is really bugging me that I can't resolve it
Thanks in advance!
 
 
 


Old
  Post #4 (permalink)   10-04-2004, 10:02 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
While I cannot be sure without seeing how the date is stored, it seems as though your echo is the issue.

Change the following code:
Code:
<input name="date_msg" type="hidden" id="date_msg" value="<?php echo date('Y/m/d'); ?>">
To:
Code:
<input name="date_msg" type="hidden" id="date_msg" value="<?php echo date('dd/mm/yyyy'); ?>">
See if that fixes it for you.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #5 (permalink)   10-05-2004, 01:37 AM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Dear ANMMark,
Thank you very much for your reply.
The data is stored in my MySQL table in the standart format - yyyy-mm-dd. I don't know how to change that. So when I corrected the code with the one you suggested the result was the following:
Thw date was submitted in the dd/mm/yyyy format but when it was retrieved from the MySQL table it looked rather bizzare - yydd-mm-yy - i.e. - if the submitted date is 17/10/2004, the returned date is 2017-10-20...
Any duggestions?
Thanks in advance!
 
 
 


Old
  Post #6 (permalink)   10-05-2004, 06:36 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
In this case I would really need to see the script that adds the date to the database, as this would be what you need to change.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #7 (permalink)   10-05-2004, 08:17 AM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Ok - do you mind if I send it to you via e-mail?
 
 
 


Old
  Post #8 (permalink)   10-05-2004, 08:25 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
Might be best to zip it up and attach it here. That way, others can have a look as well, and might be able to pinpoint something, should I miss it.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #9 (permalink)   10-05-2004, 02:29 PM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Ok. There is the file - zipped.
Thanks in advance.
Attached Files
File Type: zip addmsg.zip (2.1 KB, 13 views)
 
 
 


Old
  Post #10 (permalink)   10-06-2004, 08:17 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
The file you provided simply echos a date function, and formats the date within the form.

There doesn't seem to be any code there, that actually inserts it into the database.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #11 (permalink)   10-06-2004, 11:13 AM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Yes, this form inserts automatically the date on which the message is submitted... I tried other formats for submitting the date to the MySQL table but I wrote already what the results were... Any ideas how the problem could be solved? Or at least a place when I can look up for a solution?
ANMMark - thank you very much for your time and for your replies...
 
 
 


Old
  Post #12 (permalink)   10-06-2004, 11:35 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
Here's the problem in regards to this file inserting the data into the database.....there is no database insert query in this file. Therefore, this file itself cannot be the one which enters the data into the database.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #13 (permalink)   10-06-2004, 11:37 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
I take that back. upon checking it further. I found the insert. Will get back to you.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #14 (permalink)   10-06-2004, 11:41 AM
HD Community Advisor
 
ANMMark's Avatar
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,580

Status: ANMMark is offline
change <?php echo date('Y/m/d'); ?> to <?php echo date('d/m/Y'); ?>

Since this is indeed the format for the date getting inserted, this is the only place that would define how it gets entered.
__________________
Mark - Co-President/Lead Developer
avidInteractive Software
The ServeraSuite 2007 Award Winning Professional Server Monitoring Solution - Click here
 
 
 


Old
  Post #15 (permalink)   10-06-2004, 05:00 PM
HD Newbie
 
Join Date: Oct 2004
Posts: 7

Status: Svetly is offline
Right, I solved the problem - the solution was SO simple and it is really frustrating that it didn't come to me in the first place.
I changed the code with the one you suggested, but from previous experience, the date was displayed then all wrong. What was wrong, was that the table in MySQL was set to receive a data - therefore it formatted the input data by the standart MySQL formatting. So I changed the row type to TEXT instead DATA and it worked
So now, the string submits the echoed data in the format "d/m/Y" and it is entered in the table in the columnt as text. And the formatting problem is solved!
ANMMark - special gratitudes to you for your help and hints that resolved this! Thanks!

Last edited by Svetly : 10-06-2004 at 05:02 PM.
 
 
 
Reply
Previous Thread Next Thread


Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On