---
title: "Date Format Comparison Issue"  
description: "Date Format Comparison Issue"  
author: "marcel ethan"  
published: 2014-03-06  
updated: 2014-03-06  
canonical: https://www.mindstick.com/forum/1976/date-format-comparison-issue  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Date Format Comparison Issue

I need to [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) an [condition](https://www.mindstick.com/forum/12711/select-query-with-and-condition) where after [starting](https://www.mindstick.com/blog/12024/things-you-need-to-know-when-starting-your-own-business) from 150 [days](https://www.mindstick.com/articles/157271/how-to-get-cloudways-free-trial-for-14-days-free) from today using the [system](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business) [date format](https://www.mindstick.com/forum/1872/how-do-i-convert-string-value-to-a-date-format).

[String](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) [test](https://yourviews.mindstick.com/story/1427/explosive-facts-about-trinity-test-world-s-first-nuclear-bomb) = DateTime.Now.ToString("dd.MM.yyy");

String test2 =DateTime.Now.AddDays(150).ToString("dd.MM.yyy");

if (test == test2)//Not sure how to do it in IF condition here for date tim

{

}

Any help on this would be great.

## Replies

### Reply by Pravesh Singh

Hi Marcel,\

var dateToUse = DateTime.Now; // can be any DateTime value, if you use DateTime.Now the condition is useless

var date1 = dateToUse.[Date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner); // Get Date part

var date2 = DateTime.Today.AddDays(150);

if (date1 == date2)

; // Do something if dates are equal


---

Original Source: https://www.mindstick.com/forum/1976/date-format-comparison-issue

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
