sciris-dates
/sciris-dates
Use when working with dates, times, or timing in Sciris — sc.timer, sc.tic, sc.toc, sc.date, sc.daterange, sc.datedelta, sc.now, sc.getdate, sc.time, sc.timedsleep, sc.randsleep, date format conversion, or timing code blocks.
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when working with dates, times, or timing in Sciris — sc.timer, sc.tic, sc.toc, sc.date, sc.daterange, sc.datedelta, sc.now, sc.getdate, sc.time, sc.timedsleep, sc.randsleep, date format conversion, or timing code blocks.
Original author description
Use when working with dates, times, or timing in Sciris — sc.timer, sc.tic, sc.toc, sc.date, sc.daterange, sc.datedelta, sc.now, sc.getdate, sc.time, sc.timedsleep, sc.randsleep, date format conversion, or timing code blocks.
How it works
- Timing Code
- Sleep Utilities
- Date Utilities
SKILL.md preview
---
name: sciris-dates
description: Use when working with dates, times, or timing in Sciris — sc.timer, sc.tic, sc.toc, sc.date, sc.daterange, sc.datedelta, sc.now, sc.getdate, sc.time, sc.timedsleep, sc.randsleep, date format conversion, or timing code blocks.
---
# Sciris Dates and Times
Reference for timing and date utilities. See full tutorial: `docs/tutorials/tut_dates.ipynb`.
If you need more detail, use your MCP tools (Context7 or GitMCP) to look up current Sciris documentation, or consult the other Sciris skills.
## Timing Code
### Timer object
```python
T = sc.timer()
zeros = np.zeros((n, n))
T.tt('Make zeros') # toc-then-tic (prints elapsed, resets)
rand = np.random.rand(n, n)
T.tt('Make random')
```
### Context manager
```python
with sc.timer('My operation'):
expensive_work()
```
### Timer statistics
```python
T = sc.timer()
for i in range(10):
work(i)
T.tt(f'Iteration {i}')
print(T.mean(), T.std(), T.min(), T.max())
T.plot() # Plot timing results
```
## Sleep Utilities
```python
sc.timedsleep(0.3) # Like time.sleep()
# In a loop: accounts for computation time so each iteration = exact duration
for i in range(5):
sc.timedsleep('start')
do_work()
sc.timedsleep(0.3, verbose=True) # Total iteration = 0.3s
sc.randsleep(0.2) # Sleep random 0-0.4s (mean 0.2)
```
## Date Utilities
### Current time
```python
sc.time() # Unix timestamp (time.time())
sc.now() # datetime.datetime.now()
sc.getdate() # Formatted string: '2024-Mar-15 14:30:00'
```
### Date conversion
```python
sc.date('2022-03-04') # str → datetime
sc.date('04-03-2022', format='mdy') # Explicit format
sc.date('04-03-2022', format='dmy') # Day-month-year
```
### Date ranges and math
```python
dates = sc.daterange('2022-02-02', '2022-03-04') # List of date strings
dates = sc.daterange('2022-01-01', '2022-12-31', as_date=True) # As datetime objects
newdates = sc.datedelta(dates, months=10) # Add 10 months
```
Versions
The database has no other skills named sciris-dates.
Database snapshot: 13.11.2026 · package version c8ea0523ed97 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 95sciris-utils
Use when working with Sciris miscellaneous utilities — sc.mergedicts, sc.mergelists, sc.tolist, sc.toarray, sc.isnumber, sc.suggest, sc.download, sc.runcommand, sc.importbypath, sc.loadtext, sc.help, sc.traceback, sc.autolist, sc.pp, or type checking/conversion. - 95sciris-intro
Use when the user needs to implement a basic Sciris features — finding array values, plotting with date formatting, objdict containers, saving/loading objects, or parallelization. - 90date-time-edge-cases
Generate the date and time test cases that break business software: time zones and DST changes, end of month and leap years, fiscal years not aligned with calendar years, cut-off times, date-only vs timestamp, locale formats, week numbers and public holidays. Use when testing…