Created
April 9, 2011 10:23
Storing date/time properties in Titanium Mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CJ_Reed, 9th Apr 2011 | |
// --------------------- | |
// Storing date/time properties in Titanium Mobile | |
// (Rather than convert to text and back) | |
// create array and insert date/time value | |
var rightNowArray = []; | |
var rightNow = new Date(); | |
rightNowArray.push({time:rightNow}); | |
// store property | |
var nowList = Titanium.App.Properties.setList ('nowList',rightNowArray); | |
// retrieve property | |
var returnedNowList = Titanium.App.Properties.getList ('nowList'); | |
var returnedNow = returnedNowList[0].time; | |
// test by performing date function on returned data | |
var getTime = returnedNow.getTime(); | |
Ti.API.info("time/date: "+getTime); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment