Quick way to find out when a scratch org expires?
The sfdx force:org:display
command can also show the expiration date:
david$ sfdx force:org:display -u test-<snipped>@example.com
=== Org Description
KEY VALUE
─────────────── ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Access Token <snipped>
Client Id SalesforceDevelopmentExperience
Created By <snipped>
Created Date 2018-05-20T13:28:07.000+0000
Dev Hub Id <snipped>
Edition Enterprise
Expiration Date 2018-05-27
Id 00D3B0000004g6wUAA
Instance Url https://momentum-platform-973.cs50.my.salesforce.com
Org Name David Company
Status Active
Username <snipped>
Just took me a while Googling to find this so posting here for posterity.
This SFDX command will provide the information:
sfdx force:org:list --all
Here is an example of the output (with STATUS and EXPIRATION DATE over on the right):
ALIAS SCRATCH ORG NAME USERNAME ORG ID STATUS EXPIRATION DATE
──────────────── ──────────────── ───────────────────────────── ────────────────── ─────── ───────────────
UX [email protected] 00Df0000001oLtdEAE Expired 2018-03-20
vscodeScratchOrg UX [email protected] 00D3D0000000h8SUAQ Active 2018-05-24
I apologize for the late answer. You can use a SOQL query like the following:
sfdx force:data:soql:query -q "SELECT Name, OrgName, Edition, CreatedDate, ExpirationDate, ScratchOrg, Status FROM ScratchOrgInfo" -u DevHub
The DevHub
from the command above would be the name you have given to your devhub. You can find out more about the ScratchOrgInfo object at https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_scratchorginfo.htm.