<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Entity Framework - HaiNH</title>
	<atom:link href="https://hainh.dev/tag/entity-framework/feed/" rel="self" type="application/rss+xml" />
	<link>https://hainh.dev</link>
	<description></description>
	<lastBuildDate>Thu, 10 Jan 2019 09:56:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://hainh.dev/wp-content/uploads/2025/10/cropped-logomyblog-32x32.png</url>
	<title>Entity Framework - HaiNH</title>
	<link>https://hainh.dev</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">249252746</site>	<item>
		<title>Entity Framework so sánh giá trị ngày bỏ qua thời gian</title>
		<link>https://hainh.dev/entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian</link>
					<comments>https://hainh.dev/entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian/#respond</comments>
		
		<dc:creator><![CDATA[NGUYỄN HOÀNG HẢI]]></dc:creator>
		<pubDate>Thu, 10 Jan 2019 09:56:51 +0000</pubDate>
				<category><![CDATA[Lập trình ứng dụng]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<guid isPermaLink="false">https://hainh2k3.com/?p=1362</guid>

					<description><![CDATA[<p>Nếu như dữ liệu chúng ta lưu kiểu datetime bao gồm cả ngày và giờ nhưng khi truy vấn chỉ so sánh ngày thì mình sẽ xử lý với tham số ngày giờ truyền vào cắt hết giờ phút của nó đi, vd biến _tuNgay = &#8216;2019/10/01 15:20:23&#8217; sẽ khởi tạo lại giá trị _tuNgay...</p>
<p>The post <a href="https://hainh.dev/entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian/">Entity Framework so sánh giá trị ngày bỏ qua thời gian</a> first appeared on <a href="https://hainh.dev">HaiNH</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Nếu như dữ liệu chúng ta lưu kiểu datetime bao gồm cả ngày và giờ nhưng khi truy vấn chỉ so sánh ngày thì mình sẽ xử lý với tham số ngày giờ truyền vào cắt hết giờ phút của nó đi, vd biến <strong>_tuNgay = &#8216;2019/10/01 15:20:23&#8217;</strong> sẽ khởi tạo lại giá trị <strong>_tuNgay = new DateTime(_tuNgay.Year,_tuNgay.Month,_tuNgay.Date) </strong>. Trong câu truy vấn SQL thì mình <strong>convert(datetime,NgayBaoCao,103) &gt;= @tuNgay and convert(datetime,NgayBaoCao,103) &lt;= @denNgay</strong>. </p>
<p>Tuy nhiên trong Entity Framework nếu sử dụng các hàm ngoài vào trong câu truy vấn sẽ bị báo lỗi. Chúng ta phải sử dụng phương thức DbFunctions.TruncateTime để cắt dữ liệu ngày giờ như ví dụ dưới đây:</p>


<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="1290" height="273" data-attachment-id="2240" data-permalink="https://hainh.dev/entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian/dbfunction/" data-orig-file="https://hainh.dev/wp-content/uploads/2019/01/dbfunction.jpg" data-orig-size="1290,273" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="dbfunction" data-image-description="" data-image-caption="" data-medium-file="https://hainh.dev/wp-content/uploads/2019/01/dbfunction-300x63.jpg" data-large-file="https://hainh.dev/wp-content/uploads/2019/01/dbfunction-1024x217.jpg" src="https://hainh.dev/wp-content/uploads/2019/01/dbfunction.jpg" alt="" class="wp-image-2240" srcset="https://hainh.dev/wp-content/uploads/2019/01/dbfunction.jpg 1290w, https://hainh.dev/wp-content/uploads/2019/01/dbfunction-300x63.jpg 300w, https://hainh.dev/wp-content/uploads/2019/01/dbfunction-1024x217.jpg 1024w, https://hainh.dev/wp-content/uploads/2019/01/dbfunction-768x163.jpg 768w" sizes="(max-width: 1290px) 100vw, 1290px" /></figure><p>The post <a href="https://hainh.dev/entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian/">Entity Framework so sánh giá trị ngày bỏ qua thời gian</a> first appeared on <a href="https://hainh.dev">HaiNH</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://hainh.dev/entity-framework-so-sanh-gia-tri-ngay-bo-qua-thoi-gian/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1362</post-id>	</item>
	</channel>
</rss>
