Click here to Skip to main content
11,496,012 members (66,286 online)
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 Dnyaneshwar@Pune 692
1 CHill60 318
2 RyanDev 230
3 Sascha Lefèvre 205
4 OriginalGriff 171
0 Sergey Alexandrovich Kryukov 10,372
1 OriginalGriff 8,871
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 24 Mar 2013
Copyright © CodeProject, 1999-2015
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