Hi,
In my code i am using the following line of code
Today date: 06-07-2016
string timestamp = System.DateTime.Today.ToString("d"); (or)
string timestamp = System.DateTime.Now.ToString("d");
for above both code i am getting output as "06-07-2016" instead of output as "6".
d - day "6"
dd - day "06"
ddd - Day of week "Wed"
dddd - Day of Week "Wednesday"
Please Help me how can i get output only "6"?
Thanks,
Thirukumar.
How to get Date from Date Time
Re: How to get Date from Date Time
Hi
Try to use "%d" parameter in ToString method (instead of just "d")...
Hope this helps?
Try to use "%d" parameter in ToString method (instead of just "d")...
Code: Select all
string timestamp = System.DateTime.Today.ToString("%d");
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Posts: 8
- Joined: Tue Jun 07, 2016 8:30 am
Re: How to get Date from Date Time
Hi odklizec,
Thank You it worked. But Can you tell me the reason why we need to use "%d" instead if "d"?
Thanks,
Thirukumar.
Thank You it worked. But Can you tell me the reason why we need to use "%d" instead if "d"?
Thanks,
Thirukumar.
Re: How to get Date from Date Time
Hi,
I think the answer you are looking for is here:
https://msdn.microsoft.com/en-us/librar ... Specifiers
I think the answer you are looking for is here:
https://msdn.microsoft.com/en-us/librar ... Specifiers
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration