Skip to content

Instantly share code, notes, and snippets.

@gjuliane
Last active November 23, 2022 18:08
Show Gist options
  • Save gjuliane/f1ccbf89f7f8395e1f286e2adc9b3752 to your computer and use it in GitHub Desktop.
Save gjuliane/f1ccbf89f7f8395e1f286e2adc9b3752 to your computer and use it in GitHub Desktop.
Postman variable types
#Parsear una cadena a fecha
pm.globals.set("fProceso", Date.parse(new Date("2022-10-10 00:00:00")));
Test
# Contar número de items
var body = JSON.parse(responseBody);
tests["Count: " + body.length] = true;
Generar Java Date desde JavaScript
var d = new Date();
var n = d.toISOString();
console.log(n);
pm.globals.set("DateNow", n);
Fecha personalizada
var d = new Date("2022-10-01 00:00");
var n = d.toISOString();
pm.globals.set("DateNow", n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment