s c h e m a t i c s : c o o k b o o k

/ TimeRecipes / Cookbook.TimeEpochToTime

This Web


WebHome 
WebChanges 
TOC (with recipes)
NewRecipe 
WebTopicList 
WebStatistics 

Other Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Schematics


Schematics Home
Sourceforge Page
SchemeWiki.org
Original Cookbook
RSS

Scheme Links


Schemers.org
Scheme FAQ
R5RS
SRFIs
Scheme Cross Reference
PLT Scheme SISC
Scheme48 SCM
MIT Scheme scsh
JScheme Kawa
Chicken Guile
Bigloo Tiny
Gambit LispMe
GaucheChez

Lambda the Ultimate
TWiki.org

Converting Epoch Seconds to DMYHMS

Problem

You have a date and time in Epoch seconds, and you want to calculate individual DMYHMS values from it.

Solution

In recipe TimeToday we did exactly this but only for the current date. How about if we wanted to get the date, and time (DMYHMS) associated to a particular number of seconds? Once more we would use seconds->date.

500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

that returns "Monday, April 26th, 2004".

Discussion

In recipe TimeToday we discussed how to convert a date structure to a string. Convert in th opposite direction is also possible, and useful. Here we use SRFI 19:

500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

the resulting values will be: "Mon Apr 26 18:26:18-0500 2004", and "2004-04-26T18:26:18-0500", which represent the same date, and time but using two different formats described in ISO-8601.

Important: Note that the second argument to string->date is a formatting string that must match the format of the actual date-hour string used as the first argument.

Comments here

-- FranciscoSolsona - 28 Apr 2004

 
 
Copyright © 2004 by the contributing authors. All material on the Schematics Cookbook web site is the property of the contributing authors.
The copyright for certain compilations of material taken from this website is held by the SchematicsEditorsGroup - see ContributorAgreement & LGPL.
Other than such compilations, this material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest