Basics Of Titanium

1.Fromate Time in Titanium

title=”Download Latest or Old Version of Titanium sdk.” target=”_blank”>

var foo = new Date();

var date = dateName[foo.getMonth()] + ” ” + foo.getDate()+ ” ” +foo.getFullYear() ;

var time=String.formatTime(foo);

2. Add days on Date in Titainum

foo.setDate(foo.getDate() +364)

3. Hide Nav Bar in Titanium

var win=Ti.UI.currentWindow;


4.Alert Dialog In Titanium

var alertDialog = Titanium.UI.createAlertDialog({

title:’Alerts Empty’,

message:’To begin please add your first alert with the plus button above.’,

buttonNames : [‘Ok’]


alertDialog.addEventListener(‘click’, function(e) {

switch(e.index) {

case 0:




5.Database Management In titanium

var databaseName = ‘Reefland’;

function createDataBase(){

var db =;


db.execute(‘CREATE TABLE IF NOT EXISTS Aquarium (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name TEXT , size INTEGER, type TEXT,created_Time DATE, modified_Time DATE)’);

/*db.execute(‘CREATE TABLE IF NOT EXISTS Organizations(id INTEGER PRIMARY KEY,items_accepted Text,name Text,detail Text)’);

db.execute(‘CREATE TABLE IF NOT EXISTS DonationItems ‘+

‘(id INTEGER PRIMARY KEY,category Text,org_id INTEGER,items TEXT,date DATE,time TEXT,user_id TEXT)’);*/‘+++++++++++++++Tables check completed++++++++++’);



function db_insertAquariumItems(name,size,type,time,alt_time)


var db =;

db.execute(‘INSERT INTO Aquarium(name,size,type,created_Time,modified_Time) VALUES(?,?,?,?,?)’,name,size,type,time,alt_time);

var rows = db.execute(‘SELECT * FROM Aquarium’);‘ROW COUNT = ‘ + rows.getRowCount());




function db_fetchValuesFromDatabase(tablename)


var db =;

var rows = db.execute(‘SELECT * FROM ‘+tablename);‘ROW COUNT = ‘ + rows.getRowCount());

return rows;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: