putDate

open fun putDate(key: String, value: Date): TagsBundle.Builder

Adds a tag with a date value, formatted as "yyyy-MM-dd HH:mm".

Use for tracking important dates, milestones, or time-based events. The date is automatically converted to the format "yyyy-MM-dd HH:mm" before storage. Date tags enable time-based segmentation (e.g., users who purchased in the last 30 days, subscription expiring soon).

Example (Subscription &Events):


		Calendar cal = Calendar.getInstance();
		
		new TagsBundle.Builder()
		    // Important dates
		    .putDate("last_purchase", new Date())
		    .putDate("account_created", new Date())
		    .putDate("last_login", new Date())
		
		    // Subscription milestones
		    .putDate("trial_started", new Date())
		    .putDate("subscription_end", cal.getTime()) // Future date
		    .putDate("last_payment", new Date())
		
		    // Activity tracking
		    .putDate("last_app_open", new Date())
		    .putDate("onboarding_completed", new Date())
		    .build();
		

Note: The date format is "yyyy-MM-dd HH:mm" (e.g., "2024-01-15 14:30"). For timestamp-based tracking with millisecond precision, consider using putLong with currentTimeMillis.

Return

this Builder instance for method chaining

Parameters

key

tag name (e.g., "last_purchase", "subscription_end", "trial_started")

value

Date object to store (will be formatted as "yyyy-MM-dd HH:mm")