Nov 21, 2003 #1 dstepans Programmer Jun 3, 2003 39 US Hello, I need to get a day, month and year out of the date field. For example todays is 11/21/03 so i will need to get: month 11, day 21, year 03 Any suggestions? Thanks, Denis
Hello, I need to get a day, month and year out of the date field. For example todays is 11/21/03 so i will need to get: month 11, day 21, year 03 Any suggestions? Thanks, Denis
Nov 21, 2003 #2 vidru Programmer Jul 18, 2003 2,113 US Use the DatePart function: DatePart (intervalType, inputDateTime) yyyy - Extracts the year m - Month (the result is from 1 to 12) d - Day part of the date (1 to 31) -dave Upvote 0 Downvote
Use the DatePart function: DatePart (intervalType, inputDateTime) yyyy - Extracts the year m - Month (the result is from 1 to 12) d - Day part of the date (1 to 31) -dave
Nov 21, 2003 #3 Ngolem Programmer Aug 23, 2001 2,724 CA Assuming that this is a string not a date datatype you can use this //@ParseDate WhilePrintingRecords; numberVar tYear; NumberVar tDay; NumberVar tMonth; // assuming this format "11/21/03" tYear := toNumber({table.dateString}[7] to [8]); tDay := toNumber({table.dateString}[4] to [5]); tMonth := toNumber({table.dateString}[1] to [2]); If the field is a date then it is trivial Year({table.date}) Day({table.date}) Month({table.date}) Jim Broadbent The quality of the answer is directly proportional to the quality of the problem statement! Upvote 0 Downvote
Assuming that this is a string not a date datatype you can use this //@ParseDate WhilePrintingRecords; numberVar tYear; NumberVar tDay; NumberVar tMonth; // assuming this format "11/21/03" tYear := toNumber({table.dateString}[7] to [8]); tDay := toNumber({table.dateString}[4] to [5]); tMonth := toNumber({table.dateString}[1] to [2]); If the field is a date then it is trivial Year({table.date}) Day({table.date}) Month({table.date}) Jim Broadbent The quality of the answer is directly proportional to the quality of the problem statement!
Nov 21, 2003 Thread starter #4 dstepans Programmer Jun 3, 2003 39 US Thanks guys, that worked. Denis Upvote 0 Downvote