Date format(dd/mm/yyyy)

As mention in screen shot I want show date dd/mm/yyyy right now it is showing as mention in untittled attachment.untittled 1.I am using this code.I also try Deposit_date.tostring(“dd/MM/yyyy”) but not work this showing in textbox dd/mm/yyyy

2 Likes

Hi @Aditya10989

Please Try :smiley:
String.Format("{0: dd/MM/yyyy}",Deposit_date.ToString)

cheers :smiley:

Happy learning :smiley:

2 Likes

Hi @Aditya10989

Convert.ToDateTime(StrDate).ToString("dd/MM/yyyy hh:mm:ss)

Thanks
Ashwin S

not work

1 Like

Can you try to output this to messagebox or logit Thanks :smiley:
image

cheers :smiley:

Happy learning :smiley:

2 Likes

Hi I want this in output
12/09/2014

Hi @Aditya10989
try this

DateTime.ParseExact(str_PrevDate, “dd/MM/yyyy”, CultureInfo.InvariantCulture)

Thanks
Ashwin S

yes sure

1 Like

Hi!

Are you sure dd/MM/yyyy is the correct format? It might be MM/dd/yyyy as seen in the claim lock message on the top right.

Also these date picker fields can be tricky, as they sometimes refuse any input that is not in the correct format. If it requires hh:mm:ss you should probably add that too.
On the same note: sometimes typing into these fields doesn’t work. Try setting the value to the clipboard and pasting it like this: Date picker selection

Cheers

1 Like

Did you try to put manually the date in the applications,Maybe the datepicker in the apps always include the time what ever date that you input.Please check @Aditya10989

cheers :smiley:

Happy learning :smiley:

2 Likes

This issue now I got.

Hi @Aditya10989

try this

DateTime.ParseExact(str_PrevDate, “dd/MM/yyyy”, System.globalization.CultureInfo.InvariantCulture)

Thanks
Ashwin S

I am fetching data from excel and inserting data in web form.Now When I try to click on submit button then got message date is not correct format.So I want this format mm/dd/yyyy.if I select using date picker then the format is mm/dd/yy

How is this date in your excel file? How do you create the variable Deposit_date?

excel date format 12/9/2014
deposit_date = row.Item(1).ToString

[excel] date format 12/9/2014
deposit_date = row.Item(1).ToString

But in excel is this really a Date or it is possible already as Text? If it is a Date, then dont have deposit_date as String, keep as datetime, because you are converting it to string and this will mess it all…

now I do in code deposit_date =convert.todatetime(row.Item(1))
and changed data type to date time and
used Deposit_Date in type_into but got same result
12/09/2014 00:00:00

do deposit_date.ToString(“dd/MM/yyyy") to type into, if this put the time there, then it is something with you web application…

now I got this output in textbox showing me dd/MM/yyy and same thing display in message box output is different