Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi, I have these fields:
day_number
month_name_text ----> text format, extended names of months (january, february....)
year_number
how can I create a date in the YYYY-MM-DD format? (2023-07-17)
and how can I create a date in a format like 2023-jul-17 ?
Many thans
Date#(year_number & ' ' & month_name_text & ' ' & daynumber,'YYYY MMMM DD') should convert the separate fields to a date. You can then format the date as desired using the date() function.
Note that the month names must exactly match the ones in your regional/variable settings for this to work correctly. If that's not the case, it's probably easiest to just write a Match() statement to convert the month names to numbers and then use MakeDate(Year,Match(Stuff here),Day).
thank you, it works, but now I don't know why only May is like this
(Date#('2020 March 01', 'YYYY MMMM DD') works for me. Perhaps your month names do not match (are they in a different language, maybe)?
It'd probably be easier to just write a Match statement than to fumble around with this. Match(Field,'January','February',etc) will return the corresponding month name.