ANDROIDSTUDYCHANNEL Telegram 3319
fun covertTimeToText(dataDate: String): String? {
var convertTime: String? = null
try {
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
val pasTime: Date = dateFormat.parse(dataDate)
val nowTime = Date()
val dateDiff = floor((nowTime.time.toDouble() - pasTime.time.toDouble()) / 1000).toInt()
when {
dateDiff < 60 -> {
convertTime = "لحظاتی پیش"
}
dateDiff < 150 -> {
convertTime = "دقایقی پیش"
}
dateDiff < 300 -> {
convertTime = "۵ دقیقه پیش"
}
dateDiff < 600 -> {
convertTime = "۱۰ دقیقه پیش"
}
dateDiff < 900 -> {
convertTime = "یک ربع پیش"
}
dateDiff < 1800 -> {
convertTime = "نیم ساعت پیش"
}
dateDiff in 1800..3599 -> {
convertTime = "۴۵ دقیقه پیش"
}
dateDiff in 3600..86400 -> {
val interval = (dateDiff / 3600)
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " ساعت پیش "
}
dateDiff in 86400..2591999 -> {
val interval = (dateDiff / 86400)
when (interval) {
1 -> {
convertTime = "دیروز"
}
in 2..6 -> {
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " روز پیش "
}
7 -> {
convertTime = "یک هفته پیش"
}14 -> {
convertTime = "دو هفته پیش"
}21 -> {
convertTime = "سه هفته پیش"
}28 -> {
convertTime = "چهار هفته پیش"
}
else -> {
convertTime =
Farsi_Number_Change.Changefarsi(interval.toString()) + " روز پیش "
}
}

}
dateDiff in 2592000..31535999 -> {
val interval = (dateDiff / 2592000)
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " ماه پیش "
}

dateDiff in 31536000..915360000 -> {
val interval = (dateDiff / 31536000)
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " سال پیش "
}

}

} catch (e: Exception) {

}
return convertTime
}
👍1



tgoop.com/AndroidStudyChannel/3319
Create:
Last Update:

fun covertTimeToText(dataDate: String): String? {
var convertTime: String? = null
try {
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
val pasTime: Date = dateFormat.parse(dataDate)
val nowTime = Date()
val dateDiff = floor((nowTime.time.toDouble() - pasTime.time.toDouble()) / 1000).toInt()
when {
dateDiff < 60 -> {
convertTime = "لحظاتی پیش"
}
dateDiff < 150 -> {
convertTime = "دقایقی پیش"
}
dateDiff < 300 -> {
convertTime = "۵ دقیقه پیش"
}
dateDiff < 600 -> {
convertTime = "۱۰ دقیقه پیش"
}
dateDiff < 900 -> {
convertTime = "یک ربع پیش"
}
dateDiff < 1800 -> {
convertTime = "نیم ساعت پیش"
}
dateDiff in 1800..3599 -> {
convertTime = "۴۵ دقیقه پیش"
}
dateDiff in 3600..86400 -> {
val interval = (dateDiff / 3600)
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " ساعت پیش "
}
dateDiff in 86400..2591999 -> {
val interval = (dateDiff / 86400)
when (interval) {
1 -> {
convertTime = "دیروز"
}
in 2..6 -> {
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " روز پیش "
}
7 -> {
convertTime = "یک هفته پیش"
}14 -> {
convertTime = "دو هفته پیش"
}21 -> {
convertTime = "سه هفته پیش"
}28 -> {
convertTime = "چهار هفته پیش"
}
else -> {
convertTime =
Farsi_Number_Change.Changefarsi(interval.toString()) + " روز پیش "
}
}

}
dateDiff in 2592000..31535999 -> {
val interval = (dateDiff / 2592000)
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " ماه پیش "
}

dateDiff in 31536000..915360000 -> {
val interval = (dateDiff / 31536000)
convertTime = Farsi_Number_Change.Changefarsi(interval.toString()) + " سال پیش "
}

}

} catch (e: Exception) {

}
return convertTime
}

BY 🔴 ANDROID PROGRAMMING CHANNEL


Share with your friend now:
tgoop.com/AndroidStudyChannel/3319

View MORE
Open in Telegram


Telegram News

Date: |

Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots. Find your optimal posting schedule and stick to it. The peak posting times include 8 am, 6 pm, and 8 pm on social media. Try to publish serious stuff in the morning and leave less demanding content later in the day. During the meeting with TSE Minister Edson Fachin, Perekopsky also mentioned the TSE channel on the platform as one of the firm's key success stories. Launched as part of the company's commitments to tackle the spread of fake news in Brazil, the verified channel has attracted more than 184,000 members in less than a month. As of Thursday, the SUCK Channel had 34,146 subscribers, with only one message dated August 28, 2020. It was an announcement stating that police had removed all posts on the channel because its content “contravenes the laws of Hong Kong.” How to create a business channel on Telegram? (Tutorial)
from us


Telegram 🔴 ANDROID PROGRAMMING CHANNEL
FROM American