<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Job parameters to get date and time in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67823#M2959</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You have different options, one could be to setup the job with multiple parameters. So one parameter called `year` is represented by `&lt;SPAN data-darkreader-inline-color=""&gt;{{job.start_time.[year]}}`, another `month` represented by `&lt;/SPAN&gt;&lt;SPAN data-darkreader-inline-color=""&gt;{{job.start_time.[month]}}`, etc.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-darkreader-inline-color=""&gt;Alternatively, you could pass a single argument like `&lt;/SPAN&gt;&lt;SPAN data-darkreader-inline-color=""&gt;{{job.start_time.[iso_datetime]}}` and then parse each of the values of interest in your program. For example:&lt;BR /&gt;&lt;BR /&gt;```&lt;BR /&gt;import datetime&lt;BR /&gt;&lt;BR /&gt;iso_datetime: str = dbutils.widgets.get("iso_datetime")&lt;BR /&gt;date_object = datetime.datetime.strptime(iso_datetime, "%Y-%m-%dT%H:%M:%S.%f")&lt;BR /&gt;print(date_object.year, date_object.month, date_object.day)&lt;BR /&gt;2024 5 1&lt;BR /&gt;```&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV class="jaws-css-8t1zp7" data-testid="inline-key-value-field"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="jaws-css-8t1zp7" data-testid="inline-key-value-field"&gt;
&lt;DIV class="jaws-css-btc4se"&gt;Hope this helps.&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 01 May 2024 15:16:01 GMT</pubDate>
    <dc:creator>brockb</dc:creator>
    <dc:date>2024-05-01T15:16:01Z</dc:date>
    <item>
      <title>Job parameters to get date and time</title>
      <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67728#M2952</link>
      <description>&lt;P&gt;I'm trying to set up a workflow in databricks and I need my job parameter to get the date and time. I see in the documentation there's some options for dynamic values.&lt;/P&gt;&lt;P&gt;I'm trying to use this one:&amp;nbsp;{{job.start_time.[argument]}}&lt;/P&gt;&lt;P&gt;For the "argument" there, is it possible to have multiple arguments? if so, what's the right sintax? I'm trying to used&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;year&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;month&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;day&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;hour&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;minute&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;second&amp;nbsp;as I&amp;nbsp;&lt;/SPAN&gt;see in the documentation these are valid arguments, but seems it's only taking one at a time. How do I get all?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 18:22:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67728#M2952</guid>
      <dc:creator>mh_db</dc:creator>
      <dc:date>2024-04-30T18:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Job parameters to get date and time</title>
      <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67823#M2959</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You have different options, one could be to setup the job with multiple parameters. So one parameter called `year` is represented by `&lt;SPAN data-darkreader-inline-color=""&gt;{{job.start_time.[year]}}`, another `month` represented by `&lt;/SPAN&gt;&lt;SPAN data-darkreader-inline-color=""&gt;{{job.start_time.[month]}}`, etc.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-darkreader-inline-color=""&gt;Alternatively, you could pass a single argument like `&lt;/SPAN&gt;&lt;SPAN data-darkreader-inline-color=""&gt;{{job.start_time.[iso_datetime]}}` and then parse each of the values of interest in your program. For example:&lt;BR /&gt;&lt;BR /&gt;```&lt;BR /&gt;import datetime&lt;BR /&gt;&lt;BR /&gt;iso_datetime: str = dbutils.widgets.get("iso_datetime")&lt;BR /&gt;date_object = datetime.datetime.strptime(iso_datetime, "%Y-%m-%dT%H:%M:%S.%f")&lt;BR /&gt;print(date_object.year, date_object.month, date_object.day)&lt;BR /&gt;2024 5 1&lt;BR /&gt;```&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV class="jaws-css-8t1zp7" data-testid="inline-key-value-field"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="jaws-css-8t1zp7" data-testid="inline-key-value-field"&gt;
&lt;DIV class="jaws-css-btc4se"&gt;Hope this helps.&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 May 2024 15:16:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67823#M2959</guid>
      <dc:creator>brockb</dc:creator>
      <dc:date>2024-05-01T15:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Job parameters to get date and time</title>
      <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67969#M2968</link>
      <description>&lt;P&gt;I defined the job parameter in job using&amp;nbsp;&lt;SPAN&gt;{{job.start_time.[iso_datetime]}} and then I added the lines you suggested in notebook but getting an error "com.databricks.dbutils_v1.InputWidgetNotDefined: No input widget named iso_datetime is defined"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;import datetime&lt;BR /&gt;iso_datetime: str = dbutils.widgets.get("iso_datetime")&lt;BR /&gt;date_object = datetime.datetime.strptime(iso_datetime, "%Y-%m-%dT%H:%M:%S.%f")&lt;BR /&gt;print(date_object.year, date_object.month, date_object.day)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 19:57:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67969#M2968</guid>
      <dc:creator>mh_db</dc:creator>
      <dc:date>2024-05-02T19:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Job parameters to get date and time</title>
      <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67975#M2969</link>
      <description>&lt;P&gt;When adding parameters to the job under "Edit Parameters", you provide a `Key` and then the `Value`. In my example, the `Key` was `iso_datetime` (which is what was referenced in the notebook) and the `Value` was `{{job.start_time.[iso_datetime]}}`. &lt;BR /&gt;&lt;BR /&gt;What was the name of your `Key`?&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 20:45:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67975#M2969</guid>
      <dc:creator>brockb</dc:creator>
      <dc:date>2024-05-02T20:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Job parameters to get date and time</title>
      <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67976#M2970</link>
      <description>&lt;P&gt;I have LoadID as key and value&amp;nbsp;&lt;SPAN&gt;{{job.start_time.[iso_datetime]}}&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 20:47:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67976#M2970</guid>
      <dc:creator>mh_db</dc:creator>
      <dc:date>2024-05-02T20:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Job parameters to get date and time</title>
      <link>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67981#M2971</link>
      <description>&lt;P&gt;Then please change the code to:&lt;BR /&gt;```&lt;BR /&gt;iso_datetime = dbutils.widgets.get("&lt;SPAN&gt;LoadID&lt;/SPAN&gt;")&lt;BR /&gt;```&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2024 23:12:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/job-parameters-to-get-date-and-time/m-p/67981#M2971</guid>
      <dc:creator>brockb</dc:creator>
      <dc:date>2024-05-02T23:12:17Z</dc:date>
    </item>
  </channel>
</rss>

