Below is a list containing the SQL Server data types, in order of precedence.
Continue readingTag: convert
3 Ways to Convert a String to a Date in MongoDB
If you have a MongoDB collection with dates stored as strings, you can convert those into the Date BSON type if required.
Below are three ways to convert a string into a Date in MongoDB.
Continue reading3 Ways to Convert a Date to a String in MongoDB
MongoDB has a Date BSON type that allows you to store dates as dates.
You can also store dates as strings, if that’s what you need.
Taking it a step further, you can also convert a Date to a string.
This article presents three ways to convert a Date to a string in MongoDB.
Continue readingHow CONVERT() Works in MariaDB
In MariaDB, CONVERT()
is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.
You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.
CONVERT()
is similar to CAST()
.
How CAST() Works in MariaDB
In MariaDB, CAST()
is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.
You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.
CAST()
works similar to CONVERT()
.
Convert a Date to Another Time Zone in SQL Server
The AT TIME ZONE
clause was introduced in SQL Server 2016 to convert a date into a datetimeoffset value in a target time zone.
This function is similar to some other T-SQL functions, such as SWITCHOFFSET()
and TODATETIMEOFFSET()
, however, the AT TIME ZONE
clause allows/(requires) you to specify the time zone offset by name, instead of an actual offset value.
This article explores how AT TIME ZONE
works, and explains its benefits when compared to the other functions mentioned.
MongoDB $toUpper
In MongoDB, the $toUpper
aggregation pipeline operator converts a string to uppercase and returns the result.
MongoDB $toLower
In MongoDB, the $toLower
aggregation pipeline operator converts a string to lowercase and returns the result.
MongoDB $toObjectId
From MongoDB 4.0, you can use the $toObjectId
aggregation pipeline operator to convert a string to an ObjectId.
The string must be a hexadecimal string of length 24.
Continue readingMongoDB $toLong
From MongoDB 4.0, you can use the $toLong
aggregation pipeline operator to convert a value to a long.