<?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>question Format Correct Between in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/format-correct-between/m-p/3044731#M871</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Guys, please help me, what is the correct format to use between in a get request to get time intervals?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// const startDate = '2024-09-11 00:00:00';
// const endDate = '2024-09-12 23:59:59';
// const between = `opened_atBETWEEN${startDate}@${endDate}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I want to make a get request to get a specific time interval but this way it is not bringing all the data, so I don't know if there is something missing in the format, please help me.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm creating a function to automatically get yesterday's and today's data, but I don't know if the format is correct:&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { subDays, startOfDay, endOfDay, format } from 'date-fns';

// Pega a data de ontem e formata para começar à meia-noite
const yesterdayStart = startOfDay(subDays(new Date(), 1));
const todayEnd = endOfDay(new Date()); // Data de hoje até as 23:59:59
// Função para formatar a data no padrão que a API espera (YYYY-MM-DD HH:MM:SS)
const formatDate = (date: Date): string =&amp;gt; {
  return format(date, 'yyyy-MM-dd HH:mm:ss');
};
// Define as variáveis de data
const startDate = formatDate(yesterdayStart);  // Meia-noite de ontem
const endDate = formatDate(todayEnd);          // 23:59:59 de hoje

// Comando BETWEEN para filtrar entre as duas datas
const between = `opened_atBETWEEN${startDate}@${endDate}`;&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Sep 2024 15:11:35 GMT</pubDate>
    <dc:creator>Arthur Sanchez</dc:creator>
    <dc:date>2024-09-13T15:11:35Z</dc:date>
    <item>
      <title>Format Correct Between</title>
      <link>https://www.servicenow.com/community/community-central-forum/format-correct-between/m-p/3044731#M871</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Guys, please help me, what is the correct format to use between in a get request to get time intervals?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// const startDate = '2024-09-11 00:00:00';
// const endDate = '2024-09-12 23:59:59';
// const between = `opened_atBETWEEN${startDate}@${endDate}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I want to make a get request to get a specific time interval but this way it is not bringing all the data, so I don't know if there is something missing in the format, please help me.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm creating a function to automatically get yesterday's and today's data, but I don't know if the format is correct:&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { subDays, startOfDay, endOfDay, format } from 'date-fns';

// Pega a data de ontem e formata para começar à meia-noite
const yesterdayStart = startOfDay(subDays(new Date(), 1));
const todayEnd = endOfDay(new Date()); // Data de hoje até as 23:59:59
// Função para formatar a data no padrão que a API espera (YYYY-MM-DD HH:MM:SS)
const formatDate = (date: Date): string =&amp;gt; {
  return format(date, 'yyyy-MM-dd HH:mm:ss');
};
// Define as variáveis de data
const startDate = formatDate(yesterdayStart);  // Meia-noite de ontem
const endDate = formatDate(todayEnd);          // 23:59:59 de hoje

// Comando BETWEEN para filtrar entre as duas datas
const between = `opened_atBETWEEN${startDate}@${endDate}`;&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 15:11:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/format-correct-between/m-p/3044731#M871</guid>
      <dc:creator>Arthur Sanchez</dc:creator>
      <dc:date>2024-09-13T15:11:35Z</dc:date>
    </item>
  </channel>
</rss>

