i am using 4 date n time picker on the form in formate option i manage only date but the
file stored contain date and time but i want only date.
File handling
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 15, 2012, 7:13 AM EDT
string dateStr = dateTimePicker1.Value.ToString("dd-MMM-yy");
and then slot that into your record.
VulpesRank #55 · 29.2K reputationPosted Aug 15, 2012, 5:31 AM EDT
dd/MM/yyyy HH:mm:ss
then one way to get rid of the time element is to apply the String.Split method before you parse it to a DateTime value. For example:
string readFromFile = "15/08/2012 14:00:00"; // if days precede months in your culture
string dateStr = readFromFile.Split(' ')[0];
DateTime date = DateTime.Parse(dateStr);
dateTimePicker1.Value = date;
Another way is to parse it, as it stands, to a DateTime and then use the DateTime.Date property to extract just the date:
ta mu198 reputationPosted Aug 15, 2012, 6:57 AM EDT
i just need to formate it
like
M Tayyab 20 Male 16-Aug-12 3:31:27 PM 17-Aug-12 3:31:28 PM 18-Aug-12 3:31:28 PM
this is one record i want
M Tayyab 20 Male 16-Aug-12 17-Aug-12 18-Aug-12
thats it.