<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kevin Fowlks</title>
    <description>The latest articles on DEV Community by Kevin Fowlks (@kfowlks).</description>
    <link>https://dev.to/kfowlks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F172711%2Fc8c402b5-1412-4da0-ac03-9a861f830e4d.png</url>
      <title>DEV Community: Kevin Fowlks</title>
      <link>https://dev.to/kfowlks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kfowlks"/>
    <language>en</language>
    <item>
      <title>Python or Zig ?</title>
      <dc:creator>Kevin Fowlks</dc:creator>
      <pubDate>Sat, 13 Feb 2021 23:30:09 +0000</pubDate>
      <link>https://dev.to/kfowlks/python-or-zig-2ohc</link>
      <guid>https://dev.to/kfowlks/python-or-zig-2ohc</guid>
      <description>&lt;p&gt;Has anyone checked out &lt;a href="https://ziglang.org/"&gt;Zig&lt;/a&gt;?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to format a OData v2 Edm.DateTime column</title>
      <dc:creator>Kevin Fowlks</dc:creator>
      <pubDate>Tue, 06 Aug 2019 13:05:36 +0000</pubDate>
      <link>https://dev.to/kfowlks/how-to-format-a-odata-v2-edm-datetime-column-31a4</link>
      <guid>https://dev.to/kfowlks/how-to-format-a-odata-v2-edm-datetime-column-31a4</guid>
      <description>&lt;h2&gt;
  
  
  Use Case
&lt;/h2&gt;

&lt;p&gt;In many cases, if you are using an OData v2 entity with a column of type &lt;strong&gt;&lt;em&gt;Edm.DateTime&lt;/em&gt;&lt;/strong&gt;, you will need to some at some point construct a proper OData query string. This can be a bit of a challenge as if you don't know the correct syntax for the Edm.DateTime type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/sap/opu/odata/sap/ZGW_JOB_CLASSIFICATION_SRV/JobSet?$format=json&amp;amp;$filter=BeginDate le datetime'2019-08-02T04:00:00' and EndDate ge datetime'2019-08-02T04:00:00'&amp;amp;$select=JobCode,Title,Level,PersonSubArea,Link
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; At first glance, you might notice that this query string has a *&lt;em&gt;DateTime *&lt;/em&gt; prefix in front of the timestamp value.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/sap/opu/odata/sap/ZGW_JOB_CLASSIFICATION_SRV/JobSet?$format=json&amp;amp;$filter=BeginDate le datetime'2019-08-02T04:00:00' and EndDate ge datetime'2019-08-02T04:00:00'&amp;amp;$select=JobCode,Title,Level,PersonSubArea,Link
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;buried in the bowels of SAPUI5 framework they have an excellent helper library to help with adding such a prefix.&lt;/p&gt;

&lt;h3&gt;
  
  
  Library
&lt;/h3&gt;

&lt;p&gt;sap.ui.model.odata.odatautils&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In order to use this library in your controller you'll need to add it to your &lt;strong&gt;&lt;em&gt;sap.ui.define&lt;/em&gt;&lt;/strong&gt; array like so &lt;code&gt;"sap/ui/model/odata/ODataUtils"&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Method
&lt;/h3&gt;

&lt;p&gt;formatValue( date, EdmType)&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Usage
&lt;/h3&gt;



&lt;p&gt;&lt;code&gt;ODataUtils.formatValue(beginDate, "Edm.DateTime")&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;As you will see in the below example there is one caveat, the OData query with timestamp needs to be URLencoded so in order to do that we need to use the built-in javascript function encodeURIComponent()&lt;/p&gt;

&lt;h4&gt;
  
  
  Example :
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var sBindUrl = "/JobSet(BeginDate=" + encodeURIComponent(ODataUtils.formatValue(beginDate, "Edm.DateTime")) +  
",JobCode='" + oEvent.getParameter("arguments").jobCode + "')?$expand=JobDescriptionSet" +  
"&amp;amp;$filter=BeginDate le " + encodeURIComponent(ODataUtils.formatValue(beginDate, "Edm.DateTime"));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sapui</category>
    </item>
  </channel>
</rss>
