date time format
-
how can i convert mm/dd/yyyy hh:mm date format to current computer date format. i have date and time as string in xml file like 7/4/2007 4:48 PM now i need to match it with cuurent time i.e System.Datetime.Now() if the current computer date time format it like mm-dd-yyy hh:mm(which i am not sure can in any format) so i want to convert my datetime to current computer date time format. How can i achieve it. i am using framework 1.1
-
how can i convert mm/dd/yyyy hh:mm date format to current computer date format. i have date and time as string in xml file like 7/4/2007 4:48 PM now i need to match it with cuurent time i.e System.Datetime.Now() if the current computer date time format it like mm-dd-yyy hh:mm(which i am not sure can in any format) so i want to convert my datetime to current computer date time format. How can i achieve it. i am using framework 1.1
You didn't specify the source of "your" date time format but it really shouldn't matter. If nothing else you can compare the individual fields. DateTime tmp = DateTime.Now(); if ( your.year == tmp.year && your.month == tmp.month ... You get the idea. If you use visual studio put the cursor on DataTime and press F1.:) ken.tachyon
-
You didn't specify the source of "your" date time format but it really shouldn't matter. If nothing else you can compare the individual fields. DateTime tmp = DateTime.Now(); if ( your.year == tmp.year && your.month == tmp.month ... You get the idea. If you use visual studio put the cursor on DataTime and press F1.:) ken.tachyon
if my date time format is mm/dd/yyyy i.e in xml file and current computer date time format is mm-dd-yyyy can i convert my datetime string to new date time or is it that i have to parse individually year month date hour and minute and then compare
-
if my date time format is mm/dd/yyyy i.e in xml file and current computer date time format is mm-dd-yyyy can i convert my datetime string to new date time or is it that i have to parse individually year month date hour and minute and then compare
If you know the input format, you can parse it manually to get the date, month and year. With this, you can construct a DateTime object and convert it to whatever format you please using the ToString() method and its overloads. Alternatively, you could just build the date string you need using the date, month and year that you've extracted. A word of advice - if you're exchanging data between different apps, the ISO format (yyyy-MM-dd) is the only sane thing to use.
Cheers, Vıkram.
After all is said and done, much is said and little is done.
-
how can i convert mm/dd/yyyy hh:mm date format to current computer date format. i have date and time as string in xml file like 7/4/2007 4:48 PM now i need to match it with cuurent time i.e System.Datetime.Now() if the current computer date time format it like mm-dd-yyy hh:mm(which i am not sure can in any format) so i want to convert my datetime to current computer date time format. How can i achieve it. i am using framework 1.1
Try:
DateTime.ParseExact()
That takes the date/time as string and the format as string array.Mohamed Gouda Egypt
-
how can i convert mm/dd/yyyy hh:mm date format to current computer date format. i have date and time as string in xml file like 7/4/2007 4:48 PM now i need to match it with cuurent time i.e System.Datetime.Now() if the current computer date time format it like mm-dd-yyy hh:mm(which i am not sure can in any format) so i want to convert my datetime to current computer date time format. How can i achieve it. i am using framework 1.1
justintimberlake wrote:
how can i convert mm/dd/yyyy hh:mm date format to current computer date format
string your_string_XML_Date =your_XML_Date.ToString(CultureInfo.CurrentCulture); string currentDateTime = DateTime.Now.ToString(CultureInfo.CurrentCulture); `Hope that helped Nassos GanDad `
-
if my date time format is mm/dd/yyyy i.e in xml file and current computer date time format is mm-dd-yyyy can i convert my datetime string to new date time or is it that i have to parse individually year month date hour and minute and then compare
I tried to reply to your email but had a display name problem and could not. If you are still having problems send an email to this message giving me a sample of the code you are having the problem with. I will be able to look at it and respond to you then.