目前使用微信云开发,数据库也是云数据库,现在需要从数据库 生日表中 查询本月过生日的人员信息,之前用SQL时一般用select * from student where month(birthday)=month(getdate()) 从student表中,直接将birthday字段格式化成month进行比对,小程序中试了不能用。请问有没有类似的方法??
数据库生日存的是date类型
有没人大神提个思路,我自己去查资料就行,自己想了好久,试了好多方法,百度也查不到,实在不行我只能在数据库里面加一个月份的字段,专门存月份,但是感觉好LOW,即然存了日期格式就应该可以取才对呀。

//调试通过:新生成一个字段birthmonth, 再筛选(match)varlnmonth = 9// calend monthvardb1 = wx.cloud.database()const $ = db1.command.aggregatedb1.collection('col1').aggregate().project({ studname:true, birthday:true, birthmonth: $.month('$birthday') }).match({birthmonth: lnmonth}).end().then(res => {console.log(res)}, err => {console.log('error1: ', err)})不知道你说的是不是这个,可以看一下这里
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/aggregate/AggregateCommand.dateFromParts.html