3
Answers

Two Dates Different values retrive

Photo of Senzeye

Senzeye

9y
1.1k
1
  1. CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_select_reg`(In date1 varchar(50),In date2 varchar(50))  
  2. BEGIN  
  3.   
  4. select * from `reg` where date > cast(date1 as datetime) and date < cast(vvsysdate as date2) ORDER BY date ASC;  
  5.   
  6. END  
date values  does't  retrived correct   vales from database . 
 
my  date format is dd/MM/yyyy    
 
 how can i solve this problem ?. please help me.

Answers (3)

0
Photo of Prakash Tripathi
26 41k 6.4m 9y
Guys. His query is of MYSQL. See the DEFINER Keyword.
 
Did you tried using STR_TO_DATE. You may follow more at below SO link.
http://stackoverflow.com/questions/10637581/mysql-date-format-dd-mm-yyyy-select-query
 
 If this helps to address the issue, please close the thread by accepting the answer.
0
Photo of Rajeesh Menoth
66 27.1k 2.7m 9y
Hi,
 
 
You can use the British/French Format in Sql.
  1. CONVERT(VARCHAR(11),GETDATE(),103)  
Reference :
 
https://dzone.com/articles/custom-date-formatting-sql-ser
 
http://www.w3schools.com/sql/func_convert.asp 
 
0
Photo of Prasanth Radhakrishnan
NA 617 727.6k 9y
try this :
1 .String.Format("{0:dd/MM/yyyy}", DateTime.Now) 26/07/2012  
 2. String.Format("{0:MM/dd/yyyy}", DateTime.Now)  07/26/2012  
 3 . String.Format("{0:dd/MM/yy}", DateTime.Now)  26/09/12   
4. String.Format("{0:t}", DateTime.Now)  10:30 AM  
 5.String.Format("{0:F}", DateTime.Now) Saturday, July 26, 2012 10:36:25 AM
 http://www.codeproject.com/Questions/428390/How-to-get-date-from-server-in-mm-dd-yyyy-format