Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
im insert date in database is mm/dd/yyyy format but i want to retrieve date in dd/mm/yyyy format n show in masktextbox in cs page so that's y im use
select Convert(varchar(100),DateOfBirth,103) as DateOfBirth from Physio_cureTable this query n pass parameter in my retrieve query but it give me index out bond error n date also not retrieve
 
all details retrieve query
 
select RegisterNo,Convert(varchar(100),RegistrationDate,103) as RegistrationDate,Stimulation,PationName,DateOfBirth,ContactNo,Occupation,Age,Sex,Weight,Chief_Complain,Investigation_Result,PastHistoryAny,Physical_Examination,Ref_By_Doctor,Medications,Prognosis,Electro_Therapy,Neuro_Rehabilitation,Ortho_Rehabilitation,Cardio_Pulmonery_Rehabilitation,Sports_Rehabilitation from Physio_cureTable where RegisterNo=@RegisterNo and Syncoperation <>'D'
 

 
please give me your suggestion or give me fresh code how to convert mm/dd/yyyy date in dd/mm/yyyy format in sql server and show masktextox in cs
Posted 23-Mar-13 22:18pm
Comments
Prasad Khandekar at 24-Mar-13 3:46am
   
What's the data type of RegistrationDate, Have you tried executing this query from SQL Server Management Studio?
Atul Rokade at 24-Mar-13 3:57am
   
prasad dude yes i have tried to execute this query and it is giving me perfect output and RegistrationDate i have use datetime and dateofbirth also datetime
Atul Rokade at 24-Mar-13 3:58am
   
and i won't have problem in RegistrationDate i have problem in dateofbirth field it is store mm/dd/yyyy format but cant retrieve dd/mm/yyyy format

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

did RegistrationDate is a datetime field?
If not first convert to datetime
  Permalink  
Comments
Atul Rokade at 24-Mar-13 3:57am
   
it is datetime field
Atul Rokade at 24-Mar-13 3:58am
   
and i won't have problem in RegistrationDate i have problem in dateofbirth field it is store mm/dd/yyyy format but cant retrieve dd/mm/yyyy format

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 24 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100