We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#!/usr/bin/env python3 from datetime import datetime import pytz, time, os tz = pytz.timezone('Asia/Tokyo') date = os.environ.get('DATE') year = int(date.split('-')[0]) month = int(date.split('-')[1]) day = int(date.split('-')[2]) local_datetime = datetime.now(tz=tz).replace(year=year, month=month, day=day, hour=0, minute=0, second=0, microsecond=0) unixtimestamp = time.mktime(local_datetime.timetuple()) print(unixtimestamp)
$ DATE=2016-03-02 ./jst-unixtimestamp.py 1456844400.0
$ DATE=2016-03-03 ./jst-unixtimestamp.py 1456930800.0
$ DATE=$(date --date="1 days ago" +'%Y-%m-%d') ./jst-unixtimestamp.py 1554044400.0
$ DATE=$(date +'%Y-%m-%d') ./jst-unixtimestamp.py 1554130800.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
shellと組み合わせて使ってみる例
The text was updated successfully, but these errors were encountered: