Using Powershell To Pull Your Frontmatter Date

January 02, 2022

I know I’m gonna forget this so I’m writing a post.

This is how to pull the date in UTC with the ISO format the frontmatter likes.

Write-Output "$(Get-Date -Format s -AsUTC)Z"
2022-01-02T13:23:05Z

Doing this allows you to keep your date format the same wether you are using the web UI to make post or your normal IDE to create posts. I do this because I tend to like consistency.

Here is how I can then just add it to the top of my post.

---
layout: blog
title: Get Your Date
date: "2022-01-02T13:23:05Z"
description: How to pull your date with powershell to put it in your blog frontmatter.
---

Profile picture

Written by Matthew Therault who lives and works in the midwest building insurance things.