টাইমস্ট্যাম্প ফাংশন
| নাম | বর্ণনা |
CURRENT_TIMESTAMP | অনুরোধের সময় অনুযায়ী একটি TIMESTAMP তৈরি করে। |
TIMESTAMP_TRUNC | একটি TIMESTAMP নির্দিষ্ট সূক্ষ্মতায় সংক্ষিপ্ত করে। |
UNIX_MICROS_TO_TIMESTAMP | 1970-01-01 00:00:00 UTC থেকে মাইক্রোসেকেন্ডের সংখ্যাকে একটি TIMESTAMP রূপান্তর করে। |
UNIX_MILLIS_TO_TIMESTAMP | 1970-01-01 00:00:00 UTC থেকে মিলিসেকেন্ডের সংখ্যাকে একটি TIMESTAMP রূপান্তর করে। |
UNIX_SECONDS_TO_TIMESTAMP | 1970-01-01 00:00:00 UTC থেকে সেকেন্ডের সংখ্যাকে একটি TIMESTAMP রূপান্তর করে। |
TIMESTAMP_ADD | একটি TIMESTAMP একটি সময় ব্যবধান যোগ করে |
TIMESTAMP_SUB | একটি TIMESTAMP থেকে একটি সময় ব্যবধান বিয়োগ করে |
TIMESTAMP_TO_UNIX_MICROS | একটি TIMESTAMP 1970-01-01 00:00:00 UTC থেকে মাইক্রোসেকেন্ডের সংখ্যায় রূপান্তর করে। |
TIMESTAMP_TO_UNIX_MILLIS | একটি TIMESTAMP 1970-01-01 00:00:00 UTC থেকে মিলিসেকেন্ডের সংখ্যায় রূপান্তর করে। |
TIMESTAMP_TO_UNIX_SECONDS | একটি TIMESTAMP 1970-01-01 00:00:00 UTC থেকে সেকেন্ডের সংখ্যায় রূপান্তর করে। |
TIMESTAMP_DIFF | দুটি TIMESTAMP এর মধ্যে নির্দিষ্ট unit ব্যবধানের পূর্ণ সংখ্যা ফেরত দেয়। |
TIMESTAMP_EXTRACT | TIMESTAMP থেকে একটি নির্দিষ্ট part (যেমন বছর, মাস, দিন) বের করে। |
বর্তমান সময়
সিনট্যাক্স:
current_timestamp() -> TIMESTAMP
বর্ণনা:
অনুরোধকৃত সময়ের input শুরুর টাইমস্ট্যাম্পটি গ্রহণ করে (যা 1970-01-01 00:00:00 UTC থেকে মাইক্রোসেকেন্ডের সংখ্যা হিসাবে ব্যাখ্যা করা হয়)।
এটি একটি কোয়েরির মধ্যে স্থিতিশীল, এবং একাধিকবার কল করা হলেও সর্বদা একই মানে পরিণত হবে।
TIMESTAMP_TRUNC
সিনট্যাক্স:
timestamp_trunc(timestamp: TIMESTAMP, granularity: STRING[, timezone: STRING]) -> TIMESTAMP
বর্ণনা:
একটি টাইমস্ট্যাম্পকে একটি নির্দিষ্ট সূক্ষ্মতায় সংক্ষিপ্ত করে।
granularity আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
-
microsecond -
millisecond -
second -
minute -
hour -
day -
week -
week([weekday]) -
month -
quarter -
year -
isoyear
যদি timezone আর্গুমেন্টটি প্রদান করা হয়, তাহলে সময় কর্তন প্রদত্ত টাইমজোনের ক্যালেন্ডার সীমানার উপর ভিত্তি করে হবে (যেমন, দিনের সময় কর্তন প্রদত্ত টাইমজোনের মধ্যরাত পর্যন্ত হবে)। এই কর্তন ডেলাইট সেভিংস টাইমকে সম্মান করবে।
timezone প্রদান করা না হলে, ডেটা কর্তন UTC ক্যালেন্ডারের সীমানা অনুযায়ী করা হবে।
timezone আর্গুমেন্টটি tz ডাটাবেস থেকে নেওয়া একটি টাইমজোনের স্ট্রিং উপস্থাপনা হওয়া উচিত, উদাহরণস্বরূপ America/New_York । GMT থেকে একটি অফসেট উল্লেখ করে একটি কাস্টম টাইম অফসেটও ব্যবহার করা যেতে পারে।
উদাহরণ:
timestamp | granularity | timezone | timestamp_trunc(timestamp, granularity, timezone) |
|---|---|---|---|
| ২০০০-০১-০১ ১০:২০:৩০:১২৩৪৫৬ ইউটিসি | "দ্বিতীয়" | সরবরাহ করা হয়নি | ২০০১-০১-০১ ১০:২০:৩০ ইউটিসি |
| ১৯৯৭-০৫-৩১ ০৪:৩০:৩০ ইউটিসি | "দিন" | সরবরাহ করা হয়নি | ১৯৯৭-০৫-৩১ ০০:০০:০০ ইউটিসি |
| ১৯৯৭-০৫-৩১ ০৪:৩০:৩০ ইউটিসি | "দিন" | "আমেরিকা/লস অ্যাঞ্জেলেস" | ১৯৯৭-০৫-৩০ ০৭:০০:০০ ইউটিসি |
| ২০০১-০৩-১৬ ০৪:০০:০০ ইউটিসি | সপ্তাহ (শুক্রবার) | সরবরাহ করা হয়নি | ২০০১-০৩-১৬ ০০:০০:০০ ইউটিসি |
| ২০০১-০৩-২৩ ০৪:০০:০০ ইউটিসি | সপ্তাহ (শুক্রবার) | "আমেরিকা/লস অ্যাঞ্জেলেস" | ২০০১-০৩-২৩ ১৭:০০:০০ ইউটিসি |
| ২০২৬-০১-২৪ ২০:০০:০০ ইউটিসি | "মাস" | "জিএমটি+০৬:৩২:৪৩" | ২০২৬-০১-০১T০৬:৩২:৪৩ ইউটিসি |
UNIX_MICROS_TO_TIMESTAMP
সিনট্যাক্স:
unix_micros_to_timestamp(input: INT64) -> TIMESTAMP
বর্ণনা:
input (যা 1970-01-01 00:00:00 UTC থেকে মাইক্রোসেকেন্ডের সংখ্যা হিসাবে গণ্য করা হয়) একটি TIMESTAMP রূপান্তর করে। যদি input একটি বৈধ TIMESTAMP রূপান্তর করা না যায়, তবে একটি error প্রদর্শন করে।
উদাহরণ:
input | unix_micros_to_timestamp(input) |
|---|---|
| ০ লিটার | ১৯৭০-০১-০১ ০০:০০:০০ ইউটিসি |
| ৪০০১২৩৪৫৬এল | ১৯৭০-০১-০১ ০০:০৬:৪০.১২৩৪৫৬ ইউটিসি |
| -১০০০০০০ লিটার | ১৯৬৯-১২-৩১ ২৩:৫৯:৫৯ ইউটিসি |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().as("createdAtString") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().as("createdAtString") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAtMicros").unixMicrosToTimestamp().as("createdAtString") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().alias("createdAtString") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().alias("createdAtString") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("createdAtMicros") .unix_micros_to_timestamp() .as_("createdAtString") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(unixMicrosToTimestamp(field("createdAtMicros")).as("createdAtString")) .execute() .get();
UNIX_MILLIS_TO_TIMESTAMP
সিনট্যাক্স:
unix_millis_to_timestamp(input: INT64) -> TIMESTAMP
বর্ণনা:
input (যা 1970-01-01 00:00:00 UTC থেকে মিলিসেকেন্ডের সংখ্যা হিসাবে গণ্য করা হয়) একটি TIMESTAMP রূপান্তর করে। যদি input একটি বৈধ TIMESTAMP রূপান্তর করা না যায়, তবে একটি error প্রদর্শন করে।
উদাহরণ:
input | unix_millis_to_timestamp(input) |
|---|---|
| ০ লিটার | ১৯৭০-০১-০১ ০০:০০:০০ ইউটিসি |
| ৪০০০১২৩এল | ১৯৭০-০১-০১ ০১:০৬:৪০.১২৩ ইউটিসি |
| -১০০০০০০ লিটার | ১৯৬৯-১২-৩১ ২৩:৪৩:২০ ইউটিসি |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().as("createdAtString") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().as("createdAtString") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAtMillis").unixMillisToTimestamp().as("createdAtString") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().alias("createdAtString") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().alias("createdAtString") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("createdAtMillis") .unix_millis_to_timestamp() .as_("createdAtString") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(unixMillisToTimestamp(field("createdAtMillis")).as("createdAtString")) .execute() .get();
UNIX_SECONDS_TO_TIMESTAMP
সিনট্যাক্স:
unix_seconds_to_timestamp(input: INT64) -> TIMESTAMP
বর্ণনা:
input (যা 1970-01-01 00:00:00 UTC থেকে সেকেন্ড সংখ্যা হিসাবে গণ্য করা হয়) একটি TIMESTAMP রূপান্তর করে। যদি input একটি বৈধ TIMESTAMP রূপান্তর করা না যায়, তবে একটি error প্রদর্শন করে।
উদাহরণ:
input | unix_seconds_to_timestamp(input) |
|---|---|
| ০ লিটার | ১৯৭০-০১-০১ ০০:০০:০০ ইউটিসি |
| ৬০ লিটার | ১৯৭০-০১-০১ ০০:০১:০০ ইউটিসি |
| -৩০০ লিটার | ১৯৬৯-১২-৩১ ২৩:৫৫:০০ ইউটিসি |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().as("createdAtString") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().as("createdAtString") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAtSeconds").unixSecondsToTimestamp().as("createdAtString") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().alias("createdAtString") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().alias("createdAtString") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("createdAtSeconds") .unix_seconds_to_timestamp() .as_("createdAtString") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(unixSecondsToTimestamp(field("createdAtSeconds")).as("createdAtString")) .execute() .get();
TIMESTAMP_ADD
সিনট্যাক্স:
timestamp_add(timestamp: TIMESTAMP, unit: STRING, amount: INT64) -> TIMESTAMP
বর্ণনা:
timestamp থেকে unit amount যোগ করে। amount আর্গুমেন্টটি ঋণাত্মক হতে পারে, সেক্ষেত্রে এটি TIMESTAMP_SUB- এর সমতুল্য।
unit আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
-
microsecond -
millisecond -
second -
minute -
hour -
day
প্রাপ্ত টাইমস্ট্যাম্পটি TIMESTAMP পরিসরের মধ্যে না থাকলে একটি ত্রুটি দেখানো হবে।
উদাহরণ:
timestamp | unit | amount | timestamp_add(timestamp, unit, amount) |
|---|---|---|---|
| ২০২৫-০২-২০ ০০:০০:০০ ইউটিসি | "মিনিট" | ২ লিটার | ২০২৫-০২-২০ ০০:০২:০০ ইউটিসি |
| ২০২৫-০২-২০ ০০:০০:০০ ইউটিসি | "ঘণ্টা" | -৪ লিটার | ২০২৫-০২-১৯ ২০:০০:০০ ইউটিসি |
| ২০২৫-০২-২০ ০০:০০:০০ ইউটিসি | "দিন" | ৫ লিটার | ২০২৫-০২-২৫ ০০:০০:০০ ইউটিসি |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("createdAt").timestampAdd("day", 3653).as("expiresAt") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAt").timestampAdd("day", 3653).as("expiresAt") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAt").timestampAdd(3653, .day).as("expiresAt") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAt") .timestampAdd("day", 3653) .alias("expiresAt") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAt").timestampAdd("day", 3653).alias("expiresAt") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("createdAt").timestamp_add("day", 3653).as_("expiresAt")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampAdd(field("createdAt"), "day", 3653).as("expiresAt")) .execute() .get();
TIMESTAMP_SUB
সিনট্যাক্স:
timestamp_sub(timestamp: TIMESTAMP, unit: STRING, amount: INT64) -> TIMESTAMP
বর্ণনা:
timestamp থেকে unit একটি amount বিয়োগ করে। amount আর্গুমেন্টটি ঋণাত্মক হতে পারে, সেক্ষেত্রে এটি TIMESTAMP_ADD- এর সমতুল্য।
unit আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
-
microsecond -
millisecond -
second -
minute -
hour -
day
প্রাপ্ত টাইমস্ট্যাম্পটি TIMESTAMP পরিসরের মধ্যে না থাকলে একটি ত্রুটি দেখানো হবে।
উদাহরণ:
timestamp | unit | amount | timestamp_sub(timestamp, unit, amount) |
|---|---|---|---|
| ২০২৬-০৭-০৪ ০০:০০:০০ ইউটিসি | "মিনিট" | ৪০ লিটার | ২০২৬-০৭-০৩ ২৩:২০:০০ ইউটিসি |
| ২০২৬-০৭-০৪ ০০:০০:০০ ইউটিসি | "ঘণ্টা" | -২৪ লিটার | ২০২৬-০৭-০৫ ০০:০০:০০ ইউটিসি |
| ২০২৬-০৭-০৪ ০০:০০:০০ ইউটিসি | "দিন" | ৩ লিটার | ২০২৬-০৭-০১ ০০:০০:০০ ইউটিসি |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("expiresAt").timestampSubtract("day", 14).as("sendWarningTimestamp") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("expiresAt").timestampSubtract("day", 14).as("sendWarningTimestamp") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("expiresAt").timestampSubtract(14, .day).as("sendWarningTimestamp") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("expiresAt") .timestampSubtract("day", 14) .alias("sendWarningTimestamp") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("expiresAt").timestampSubtract("day", 14).alias("sendWarningTimestamp") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("expiresAt") .timestamp_subtract("day", 14) .as_("sendWarningTimestamp") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampSubtract(field("expiresAt"), "day", 14).as("sendWarningTimestamp")) .execute() .get();
TIMESTAMP_TO_UNIX_MICROS
সিনট্যাক্স:
timestamp_to_unix_micros(input: TIMESTAMP) -> INT64
বর্ণনা:
1970-01-01 00:00:00 UTC থেকে input মাইক্রোসেকেন্ডের সংখ্যায় রূপান্তর করে। উচ্চতর নির্ভুলতার মানকে মাইক্রোসেকেন্ডের শুরুতে রাউন্ড ডাউন করে ছেঁটে ফেলে।
উদাহরণ:
input | timestamp_to_unix_micros(input) |
|---|---|
| ১৯৭০-০১-০১ ০০:০০:০০ ইউটিসি | ০ লিটার |
| ১৯৭০-০১-০১ ০০:০৬:৪০.১২৩৪৫৬ ইউটিসি | ৪০০১২৩৪৫৬এল |
| ১৯৬৯-১২-৩১ ২৩:৫৯:৫৯ ইউটিসি | -১০০০০০০ লিটার |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().as("unixMicros") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().as("unixMicros") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("dateString").timestampToUnixMicros().as("unixMicros") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().alias("unixMicros") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().alias("unixMicros") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("dateString").timestamp_to_unix_micros().as_("unixMicros")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampToUnixMicros(field("dateString")).as("unixMicros")) .execute() .get();
TIMESTAMP_TO_UNIX_MILLIS
সিনট্যাক্স:
timestamp_to_unix_millis(input: TIMESTAMP) -> INT64
বর্ণনা:
1970-01-01 00:00:00 UTC থেকে input মিলিসেকেন্ডের সংখ্যায় রূপান্তর করে। উচ্চতর নির্ভুলতার মানকে মিলিসেকেন্ডের শুরুতে রাউন্ড ডাউন করে ছেঁটে ফেলে।
উদাহরণ:
input | timestamp_to_unix_millis(input) |
|---|---|
| ১৯৭০-০১-০১ ০০:০০:০০ ইউটিসি | ০ লিটার |
| ১৯৭০-০১-০১ ০১:০৬:৪০.১২৩ ইউটিসি | ৪০০০১২৩এল |
| ১৯৬৯-১২-৩১ ২৩:৪৩:২০ | -১০০০০০০ লিটার |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().as("unixMillis") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().as("unixMillis") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("dateString").timestampToUnixMillis().as("unixMillis") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().alias("unixMillis") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().alias("unixMillis") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("dateString").timestamp_to_unix_millis().as_("unixMillis")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampToUnixMillis(field("dateString")).as("unixMillis")) .execute() .get();
TIMESTAMP_TO_UNIX_SECONDS
সিনট্যাক্স:
timestamp_to_unix_seconds(input: TIMESTAMP) -> INT64
বর্ণনা:
input 1970-01-01 00:00:00 UTC থেকে সেকেন্ডের সংখ্যায় রূপান্তর করে। উচ্চতর নির্ভুলতাকে সেকেন্ডের শুরুতে রাউন্ড ডাউন করে ছেঁটে ফেলে।
উদাহরণ:
input | timestamp_to_unix_seconds(input) |
|---|---|
| ১৯৭০-০১-০১ ০০:০০:০০ ইউটিসি | ০ লিটার |
| ১৯৭০-০১-০১ ০০:০১:০০ ইউটিসি | ৬০ লিটার |
| ১৯৬৯-১২-৩১ ২৩:৫৫:০০ ইউটিসি | -৩০০ লিটার |
নোড.জেএস
const result = await db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().as("unixSeconds") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().as("unixSeconds") ) );
সুইফট
let result = try await db.pipeline() .collection("documents") .select([ Field("dateString").timestampToUnixSeconds().as("unixSeconds") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().alias("unixSeconds") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().alias("unixSeconds") ) .execute();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("dateString").timestamp_to_unix_seconds().as_("unixSeconds")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampToUnixSeconds(field("dateString")).as("unixSeconds")) .execute() .get();
TIMESTAMP_DIFF
সিনট্যাক্স:
timestamp_diff(end: TIMESTAMP, start: TIMESTAMP, unit: STRING) -> INT64
বর্ণনা:
দুটি TIMESTAMP এর মধ্যে নির্দিষ্ট unit ব্যবধানের পূর্ণ সংখ্যা ফেরত দেয়।
- যদি
endstartআগে হয়, তাহলে একটি ঋণাত্মক মান ফেরত দেয়। - যেকোনো ভগ্নাংশ একক ছেঁটে ফেলে। উদাহরণস্বরূপ,
timestamp_diff("2021-01-01 00:00:01", "2021-01-01 00:00:00", "minute")0রিটার্ন করে।
unit আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
-
microsecond -
millisecond -
second -
minute -
hour -
day
উদাহরণ:
end | start | unit | timestamp_diff(end, start, unit) |
|---|---|---|---|
| ২০২৬-০৭-০৪ ০০:০১:০০ ইউটিসি | ২০২৬-০৭-০৪ ০০:০০:০০ ইউটিসি | "দ্বিতীয়" | ৬০ লিটার |
| ২০২৬-০৭-০৪ ০০:০০:০০ ইউটিসি | ২০২৬-০৭-০৫ ০০:০০:০০ ইউটিসি | "দিন" | -১ লিটার |
| ২০২৬-০৭-০৪ ০০:০০:৫৯ ইউটিসি | ২০২৬-০৭-০৪ ০০:০০:০০ ইউটিসি | "মিনিট" | ০ লিটার |
টাইমস্ট্যাম্প_এক্সট্র্যাক্ট
সিনট্যাক্স:
timestamp_extract(timestamp: TIMESTAMP, part: STRING[, timezone: STRING]) -> INT64
বর্ণনা:
timestamp থেকে একটি নির্দিষ্ট part (যেমন বছর, মাস, দিন) বের করে।
part আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
-
microsecond -
millisecond -
second -
minute -
hour -
day -
dayofweek: ১ (রবিবার) এবং ৭ (শনিবার)-এর মধ্যে একটি মান প্রদান করে। -
dayofyear -
week: বছরের সপ্তাহ সংখ্যা ফেরত দেয়, যা বছরের প্রথম রবিবার থেকে ১ হিসাবে শুরু হয়। -
week([weekday]): নির্দিষ্টweekdayথেকে শুরু করে বছরের সপ্তাহ সংখ্যা ফেরত দেয়। -
month -
quarter -
year -
isoweek: ISO 8601 সপ্তাহ নম্বরটি ফেরত দেয়। -
isoyear: ISO 8601 সপ্তাহ-সংখ্যায়ন বছরটি ফেরত দেয়।
যদি timezone আর্গুমেন্টটি প্রদান করা হয়, তাহলে ডেটা নিষ্কাশনটি প্রদত্ত টাইমজোনের ক্যালেন্ডারের উপর ভিত্তি করে করা হবে। এই নিষ্কাশনে ডেলাইট সেভিংস টাইম অনুসরণ করা হবে।
timezone প্রদান করা না হলে, ডেটা UTC অনুযায়ী নিষ্কাশন করা হবে।
timezone আর্গুমেন্টটি টাইমজোন ডেটাবেস থেকে নেওয়া কোনো টাইমজোনের একটি স্ট্রিং উপস্থাপনা হওয়া উচিত, উদাহরণস্বরূপ America/New_York । GMT থেকে একটি অফসেট উল্লেখ করে একটি কাস্টম টাইম অফসেটও ব্যবহার করা যেতে পারে।
উদাহরণ:
timestamp | part | timezone | timestamp_extract(timestamp, part, timezone) |
|---|---|---|---|
| ২০২৫-০২-২০ ১০:২০:৩০ ইউটিসি | "বছর" | সরবরাহ করা হয়নি | ২০২৫ |
| ২০২৫-০২-২০ ১০:২০:৩০ ইউটিসি | "দিন" | সরবরাহ করা হয়নি | ২০ |
| ২০২৫-১২-৩১ ২৩:৫৯:৫৯ ইউটিসি | "বছর" | "এশিয়া/টোকিও" | ২০২৬ |